Examples of PrimitiveType


Examples of jadx.core.dex.instructions.args.PrimitiveType

    }
    return field;
  }

  public FieldNode getConstFieldByLiteralArg(LiteralArg arg) {
    PrimitiveType type = arg.getType().getPrimitiveType();
    if (type == null) {
      return null;
    }
    long literal = arg.getLiteral();
    switch (type) {
View Full Code Here

Examples of jadx.core.dex.instructions.args.PrimitiveType

  private TypeGen() {
  }

  public static String signature(ArgType type) {
    PrimitiveType stype = type.getPrimitiveType();
    if (stype == PrimitiveType.OBJECT) {
      return Utils.makeQualifiedObjectName(type.getObject());
    }
    if (stype == PrimitiveType.ARRAY) {
      return '[' + signature(type.getArrayElement());
    }
    return stype.getShortName();
  }
View Full Code Here

Examples of jadx.core.dex.instructions.args.PrimitiveType

      code.add(';');
    }
  }

  public void useType(CodeWriter code, ArgType type) {
    PrimitiveType stype = type.getPrimitiveType();
    if (stype == null) {
      code.add(type.toString());
    } else if (stype == PrimitiveType.OBJECT) {
      if (type.isGenericType()) {
        code.add(type.getObject());
      } else {
        useClass(code, ClassInfo.fromType(type));
      }
    } else if (stype == PrimitiveType.ARRAY) {
      useType(code, type.getArrayElement());
      code.add("[]");
    } else {
      code.add(stype.getLongName());
    }
  }
View Full Code Here

Examples of japa.parser.ast.type.PrimitiveType

                internalType = ((ReferenceType) internalType).getType();
            }
        }

        if (internalType instanceof PrimitiveType) {
            final PrimitiveType pt = (PrimitiveType) internalType;
            if (pt.getType().equals(Primitive.Boolean)) {
                return new JavaType(Boolean.class.getName(), array,
                        DataType.PRIMITIVE, null, null);
            }
            if (pt.getType().equals(Primitive.Char)) {
                return new JavaType(Character.class.getName(), array,
                        DataType.PRIMITIVE, null, null);
            }
            if (pt.getType().equals(Primitive.Byte)) {
                return new JavaType(Byte.class.getName(), array,
                        DataType.PRIMITIVE, null, null);
            }
            if (pt.getType().equals(Primitive.Short)) {
                return new JavaType(Short.class.getName(), array,
                        DataType.PRIMITIVE, null, null);
            }
            if (pt.getType().equals(Primitive.Int)) {
                return new JavaType(Integer.class.getName(), array,
                        DataType.PRIMITIVE, null, null);
            }
            if (pt.getType().equals(Primitive.Long)) {
                return new JavaType(Long.class.getName(), array,
                        DataType.PRIMITIVE, null, null);
            }
            if (pt.getType().equals(Primitive.Float)) {
                return new JavaType(Float.class.getName(), array,
                        DataType.PRIMITIVE, null, null);
            }
            if (pt.getType().equals(Primitive.Double)) {
                return new JavaType(Double.class.getName(), array,
                        DataType.PRIMITIVE, null, null);
            }
            throw new IllegalStateException("Unsupported primitive '"
                    + pt.getType() + "'");
        }

        if (internalType instanceof WildcardType) {
            // We only provide very primitive support for wildcard types; Roo
            // only needs metadata at the end of the day,
View Full Code Here

Examples of japa.parser.ast.type.PrimitiveType

                "Java type must be primitive to be presented to this method");
        if (javaType.equals(JavaType.VOID_PRIMITIVE)) {
            return new VoidType();
        }
        else if (javaType.equals(JavaType.BOOLEAN_PRIMITIVE)) {
            return new PrimitiveType(Primitive.Boolean);
        }
        else if (javaType.equals(JavaType.BYTE_PRIMITIVE)) {
            return new PrimitiveType(Primitive.Byte);
        }
        else if (javaType.equals(JavaType.CHAR_PRIMITIVE)) {
            return new PrimitiveType(Primitive.Char);
        }
        else if (javaType.equals(JavaType.DOUBLE_PRIMITIVE)) {
            return new PrimitiveType(Primitive.Double);
        }
        else if (javaType.equals(JavaType.FLOAT_PRIMITIVE)) {
            return new PrimitiveType(Primitive.Float);
        }
        else if (javaType.equals(JavaType.INT_PRIMITIVE)) {
            return new PrimitiveType(Primitive.Int);
        }
        else if (javaType.equals(JavaType.LONG_PRIMITIVE)) {
            return new PrimitiveType(Primitive.Long);
        }
        else if (javaType.equals(JavaType.SHORT_PRIMITIVE)) {
            return new PrimitiveType(Primitive.Short);
        }
        throw new IllegalStateException("Unknown primitive " + javaType);
    }
View Full Code Here

Examples of javax.lang.model.type.PrimitiveType

   
    /**
     * INTERNAL:
     */
    protected String getBoxedType(MetadataAnnotatedElement annotatedElement) {
        PrimitiveType primitiveType = annotatedElement.getPrimitiveType();
        if (primitiveType != null) {
            return processingEnv.getTypeUtils().boxedClass(primitiveType).toString();
        }
       
        return annotatedElement.getType();
View Full Code Here

Examples of javax.lang.model.type.PrimitiveType

   
    /**
     * INTERNAL:
     */
    protected String getBoxedType(MetadataAnnotatedElement annotatedElement) {
        PrimitiveType primitiveType = (PrimitiveType) annotatedElement.getPrimitiveType();
        if (primitiveType != null) {
            return processingEnv.getTypeUtils().boxedClass(primitiveType).toString();
        }
       
        return annotatedElement.getType();
View Full Code Here

Examples of net.openhft.jpsg.PrimitiveType

        gen.lines("a[resultIndex++] = " + gen.viewElem() + ";");
    }

    @Override
    public void end() {
        PrimitiveType elemType = (PrimitiveType) cxt.viewOption();
        gen.lines(
                "if (a.length > resultIndex)",
                "    a[resultIndex] = " + elemType.formatValue("0") + ";"
        );
        gen.ret("a");
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.PrimitiveType

          return isAssignable(leftElement, rightElment);
        }
      }
    } else if (left.isPrimitiveType()) {
      if (right.isPrimitiveType()) {
        PrimitiveType leftType = (PrimitiveType) left;
        PrimitiveType rightType = (PrimitiveType) right;
        Code leftCode = leftType.getPrimitiveTypeCode();
        Code rightCode = leftType.getPrimitiveTypeCode();
        if (leftCode.toString().equals(rightCode.toString()))
          return true;
      }
    } else if (left.isParameterizedType()) {
      if (right.isParameterizedType()) {
        ParameterizedType leftType = (ParameterizedType) left;
        ParameterizedType rightType = (ParameterizedType) right;
        Type leftBaseType = leftType.getType();
        Type rightBaseType = rightType.getType();
        boolean baseAssignable = isAssignable(leftBaseType,
            rightBaseType);
        if (baseAssignable) {
          List leftArgs = leftType.typeArguments();
          List rightArgs = rightType.typeArguments();
          if (leftArgs.size() != rightArgs.size())
            return false;
          for (int i = 0; i < leftArgs.size(); i++) {
            Type leftArgType = (Type) leftArgs.get(i);
            Type rightArgType = (Type) rightArgs.get(i);
            if (!isAssignable(leftArgType, rightArgType)) {
              return false;
            }
          }
          return true;
        }
      }
    } else if (left.isQualifiedType()) {
      if(right.isQualifiedType()){
        QualifiedType leftType = (QualifiedType) left;
        QualifiedType rightType = (QualifiedType) right;
        Type leftQualifier = leftType.getQualifier();
        Type rightQualifier = rightType.getQualifier();
        SimpleName leftName = leftType.getName();
        SimpleName rightName = rightType.getName();
        boolean assignable = isAssignable(leftQualifier, rightQualifier);
        return assignable && leftName.getIdentifier().equals(rightName.getIdentifier());
      }
    } else if(left.isSimpleType()){
      if(right.isSimpleType()){
        SimpleType leftType = (SimpleType) left;
        SimpleType rightType = (SimpleType) right;
        if(leftType.getName().equals(rightType.getName()))
          return true;
      }
    }
    return false;
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.PrimitiveType

                        //We still need to add the array component type, which might be primitive or a reference
                        typeToAdd = type.getElementType();
                    }

                    if (typeToAdd.isPrimitiveType()) {
                        PrimitiveType type = (PrimitiveType) typeToAdd;
                        signatureBuilder.append(PRIMITIVES_TO_SIGNATURES.get(type.getPrimitiveTypeCode()));
                    } else if (typeToAdd.isSimpleType()) {
                        SimpleType type = (SimpleType) typeToAdd;
                        String name;
                        if (type.getName().isQualifiedName()) {
                            name = type.getName().getFullyQualifiedName();
                        } else {
                            name = getFullyQualifiedNameForSimpleName(ast, type.getName());
                        }
                        name = name.replace('.', '/');
                        signatureBuilder.append("L").append(name).append(";");
                    } else if (typeToAdd.isQualifiedType()) {
                        QualifiedType type = (QualifiedType) typeToAdd;
                        String name = type.getQualifier().toString().replace('.', '/') + '/' + type.getName().getFullyQualifiedName().replace('.', '/');
                        signatureBuilder.append("L").append(name).append(";");
                    } else {
                        throw new IllegalArgumentException("We hit an unknown type " + typeToAdd);
                    }
                }
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.