Examples of TypeKind


Examples of javax.lang.model.type.TypeKind

   
    /**
     * Affirms if the given type mirrors a primitive.
     */
    private boolean isPrimitive(TypeMirror mirror) {
        TypeKind kind = mirror.getKind();
        return kind == TypeKind.BOOLEAN
            || kind == TypeKind.BYTE
            || kind == TypeKind.CHAR
            || kind == TypeKind.DOUBLE
            || kind == TypeKind.FLOAT
View Full Code Here

Examples of javax.lang.model.type.TypeKind

  public static TypeKind widenedNumericType(TypeMirror left, TypeMirror right) {
    if (!isNumeric(left) || !isNumeric(right)) {
      return TypeKind.NONE;
    }

    TypeKind leftKind = left.getKind();
    TypeKind rightKind = right.getKind();

    if (leftKind == TypeKind.DOUBLE || rightKind == TypeKind.DOUBLE) {
      return TypeKind.DOUBLE;
    }
View Full Code Here

Examples of javax.lang.model.type.TypeKind

  public static TypeMirror typeFromClass(Types types, Elements elements, Class<?> clazz) {
    if (clazz == void.class) {
      return types.getNoType(TypeKind.VOID);
    } else if (clazz.isPrimitive()) {
      String primitiveName = clazz.getName().toUpperCase();
      TypeKind primitiveKind = TypeKind.valueOf(primitiveName);
      return types.getPrimitiveType(primitiveKind);
    } else if (clazz.isArray()) {
      TypeMirror componentType = typeFromClass(types, elements, clazz.getComponentType());
      return types.getArrayType(componentType);
    } else {
View Full Code Here

Examples of javax.lang.model.type.TypeKind

            }

            final TypeList parameterTypes = methodBuilder.getParameterTypes();
           
            for (int i = 0, n = parameterTypes.size(); i < localIndex && i < n; i++) {
                final TypeKind kind = parameterTypes.get(i).getKind();
                if (kind == TypeKind.LONG || kind == TypeKind.DOUBLE) {
                    ++index;
                }
            }
        }
View Full Code Here

Examples of javax.lang.model.type.TypeKind

            throw Error.invalidCast(sourceType, targetType);
        }
    }

    private void emitNumericConversion(final Type<?> sourceType, final Type<?> targetType) {
        final TypeKind sourceKind = sourceType.getKind();
        final TypeKind targetKind = targetType.getKind();

        if (sourceKind == targetKind) {
            return;
        }
View Full Code Here

Examples of javax.lang.model.type.TypeKind

    TypeM result = new TypeM(packageName, classname).withTypeParameter(getTypeMArray(typeElem.getTypeParameters()));
    return result;
  }

  public TypeM getTypeM(TypeMirror typeMirror) {
    TypeKind kind = typeMirror.getKind();
    switch (kind) {
      case BOOLEAN:
        return PrimitiveTypeM.BOOLEAN;
      case CHAR:
        return PrimitiveTypeM.CHAR;
View Full Code Here

Examples of javax.lang.model.type.TypeKind

                                int offset, String cname, boolean padWord) {
        boolean first = true;
        List<VariableElement> fields = ElementFilter.fieldsIn(clazz.getEnclosedElements());

        for (VariableElement field: fields) {
            TypeKind tk = field.asType().getKind();
            boolean twoWords = (tk == TypeKind.LONG || tk == TypeKind.DOUBLE);
            if (twoWords && doField(res, field, cname, first && padWord)) {
                offset += 8; first = false;
            }
        }
View Full Code Here

Examples of javax.lang.model.type.TypeKind

            if (doubleAlign && !didTwoWordFields && (offset % 8) == 0) {
                offset = doTwoWordFields(res, clazz, offset, cname, false);
                didTwoWordFields = true;
            }

            TypeKind tk = field.asType().getKind();
            boolean twoWords = (tk == TypeKind.LONG || tk == TypeKind.DOUBLE);

            if (!doubleAlign || !twoWords) {
                if (doField(res, field, cname, false)) offset += 4;
            }
View Full Code Here

Examples of javax.lang.model.type.TypeKind

            }
            public Boolean visitArray(ArrayType t, Void p) {
                return visit(t.getComponentType(), p);
            }
            public Boolean visitPrimitive(PrimitiveType t, Void p) {
                TypeKind tk = t.getKind();
                return (tk == TypeKind.LONG || tk == TypeKind.DOUBLE);
            }
        };
        return v.visit(t, null);
    }
View Full Code Here

Examples of javax.lang.model.type.TypeKind

        if(type instanceof TypeVariable)
            return TypeKind.TYPEVAR;
        if(type instanceof WildcardType)
            return TypeKind.WILDCARD;
        if(type instanceof Class){
            TypeKind kind = primitives.get(type);
            if(kind != null)
                return kind;
            return ((Class<?>)type).isArray() ? TypeKind.ARRAY : TypeKind.DECLARED;
        }
        throw new RuntimeException("Unknown type: "+type);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.