@Override public Boolean visitBottomType(final TypeReference t, final TypeReference s) { switch (t.getSimpleType()) { case Object: case Array: case TypeVariable: return true; default: return false; } }
@Override public Boolean visitBottomType(final TypeReference t, final TypeReference s) { switch (t.getSimpleType()) { case Object: case Array: case TypeVariable: return true; default: return false; } }
@Override public Boolean visitBottomType(final TypeReference t, final TypeReference s) { switch (t.getSimpleType()) { case Object: case Array: case TypeVariable: return true; default: return false; } }
private TypeReference numericPromotion(final TypeReference type) { if (type == null) { return null; } switch (type.getSimpleType()) { case Byte: case Short: return BuiltinTypes.Integer; default: return type; } }
public ParameterDefinition(final int slot, final String name, final TypeReference parameterType) { super(name, parameterType); _slot = slot; _size = parameterType.getSimpleType().isDoubleWord() ? 2 : 1; }
public ParameterDefinition(final int slot, final String name, final TypeReference parameterType) { super(name, parameterType); _slot = slot; _size = parameterType.getSimpleType().isDoubleWord() ? 2 : 1; }
private boolean isCastRequired(final TypeReference targetType, final TypeReference sourceType, final boolean exactMatch) { if (targetType == null || sourceType == null) { return false; } if (targetType.isPrimitive()) { return sourceType.getSimpleType() != targetType.getSimpleType(); } if (exactMatch) { return !MetadataHelper.isSameType(targetType, sourceType, true); } return !MetadataHelper.isAssignableFrom(targetType, sourceType); }
private boolean firstParameterIsInt(MethodReference mr) { return mr.getParameters().size() > 0 && mr.getParameters().get(0).getParameterType().getSimpleType() == JvmType.Integer; } }
private static boolean checkOperand(final OperandType operandType, final TypeReference type) { VerifyArgument.notNull(type, "type"); switch (operandType) { case PrimitiveTypeCode: return type.getSimpleType().isPrimitive(); case TypeReference: case TypeReferenceU1: return true; default: return false; } }
private static boolean checkOperand(final OperandType operandType, final TypeReference type) { VerifyArgument.notNull(type, "type"); switch (operandType) { case PrimitiveTypeCode: return type.getSimpleType().isPrimitive(); case TypeReference: case TypeReferenceU1: return true; default: return false; } }
public static boolean isBoolean(@Nullable final TypeReference type) { if (type == null) { return false; } return MetadataHelper.getUnderlyingPrimitiveTypeOrSelf(type).getSimpleType() == JvmType.Boolean; }
public static boolean isArithmetic(@Nullable final TypeReference type) { if (type == null) { return false; } final JvmType jvmType = MetadataHelper.getUnderlyingPrimitiveTypeOrSelf(type).getSimpleType(); return jvmType.isNumeric() && jvmType != JvmType.Boolean; }
private static int getTypeRank(@NotNull final TypeReference type) { final TypeReference unboxedType = MetadataHelper.getUnderlyingPrimitiveTypeOrSelf(type); final Integer rank = TYPE_TO_RANK_MAP.get(unboxedType.getSimpleType()); if (rank != null) { return rank; } if (StringUtilities.equals(type.getInternalName(), STRING_DESCRIPTOR)) { return STRING_RANK; } return Integer.MAX_VALUE; }
private void checkSignedByte(Expression expr, MethodContext mc) { JvmType type = expr.getInferredType().getSimpleType(); if (type != JvmType.Integer && type != JvmType.Long) return; if (Inf.BACKLINK.findUsages(expr).stream().allMatch(e -> e.getCode() == AstCode.I2B)) return; if (Exprs.bothChildrenMatch(expr, BadMath::isByte, BadMath::isLow8BitsClear)) { mc.report(expr.getCode() == AstCode.Add ? "BitAddSignedByte" : "BitOrSignedByte", 0, expr); } }
private int computePriority(FieldDefinition field, MethodDefinition md, NodeChain parents) { int priority = 0; JvmType type = field.getFieldType().getSimpleType(); if (type != JvmType.Long && type != JvmType.Double) priority += 10; if (Flags.testAny(md.getFlags(), Flags.SYNCHRONIZED) || parents.isSynchronized()) priority += 30; return priority; }
@Override public Boolean visitRawType(final RawType t, final TypeReference s) { return s.getSimpleType() == JvmType.Object && !s.isGenericType() && StringUtilities.equals(t.getInternalName(), s.getInternalName()); }
@Override public AstNode apply(final AstNode input) { return new BinaryOperatorExpression( operand, BinaryOperatorType.INEQUALITY, new PrimitiveExpression(Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast(comparandType.getSimpleType(), 0)) ); } }
@Override public AstNode apply(final AstNode input) { return new BinaryOperatorExpression( operand, BinaryOperatorType.INEQUALITY, new PrimitiveExpression(Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast(comparandType.getSimpleType(), 0)) ); } }
public static Expression makePrimitive(final long val, final TypeReference type) { if (TypeAnalysis.isBoolean(type)) { if (val == 0L) { return new PrimitiveExpression(Expression.MYSTERY_OFFSET, Boolean.FALSE); } return new PrimitiveExpression(Expression.MYSTERY_OFFSET, Boolean.TRUE); } if (type != null) { return new PrimitiveExpression(Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast(type.getSimpleType(), val)); } return new PrimitiveExpression(Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast(JvmType.Integer, val)); }
public static Expression makePrimitive(final long val, final TypeReference type) { if (TypeAnalysis.isBoolean(type)) { if (val == 0L) { return new PrimitiveExpression(Expression.MYSTERY_OFFSET, Boolean.FALSE); } return new PrimitiveExpression(Expression.MYSTERY_OFFSET, Boolean.TRUE); } if (type != null) { return new PrimitiveExpression(Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast(type.getSimpleType(), val)); } return new PrimitiveExpression(Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast(JvmType.Integer, val)); }