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)); }
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)); }
@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)) ); } }
@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 Expression apply(final AstNode input) { return new BinaryOperatorExpression( node, BinaryOperatorType.INEQUALITY, new PrimitiveExpression( Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast( MetadataHelper.getUnderlyingPrimitiveTypeOrSelf(type) .getSimpleType(), 0 ) ) ); } }
@Override public Expression apply(final AstNode input) { return new BinaryOperatorExpression( node, BinaryOperatorType.INEQUALITY, new PrimitiveExpression( Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast( MetadataHelper.getUnderlyingPrimitiveTypeOrSelf(type) .getSimpleType(), 0 ) ) ); } }
@Override public Expression apply(final AstNode input) { return new BinaryOperatorExpression( node, BinaryOperatorType.INEQUALITY, new PrimitiveExpression( Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast( MetadataHelper.getUnderlyingPrimitiveTypeOrSelf(type) .getSimpleType(), 0 ) ) ); } }
final double value = (double) JavaPrimitiveCast.cast(JvmType.Double, operand.getValue()); (Double.doubleToRawLongBits(value) & (1L << 63)) != 0; negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(operand.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, operand.getValue()); negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(operand.getValue(), true), -value);
final double value = (double) JavaPrimitiveCast.cast(JvmType.Double, operand.getValue()); (Double.doubleToRawLongBits(value) & (1L << 63)) != 0; negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(operand.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, operand.getValue()); negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(operand.getValue(), true), -value);
final double value = (double) JavaPrimitiveCast.cast(JvmType.Double, operand.getValue()); (Double.doubleToRawLongBits(value) & (1L << 63)) != 0; negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(operand.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, operand.getValue()); negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(operand.getValue(), true), -value);
final double value = (double) JavaPrimitiveCast.cast(JvmType.Double, right.getValue()); (Double.doubleToRawLongBits(value) & (1L << 63)) != 0; negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, right.getValue()); negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, right.getValue());
final double value = (double) JavaPrimitiveCast.cast(JvmType.Double, right.getValue()); (Double.doubleToRawLongBits(value) & (1L << 63)) != 0; negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, right.getValue()); negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, right.getValue());
final double value = (double) JavaPrimitiveCast.cast(JvmType.Double, right.getValue()); (Double.doubleToRawLongBits(value) & (1L << 63)) != 0; negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, right.getValue()); negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, right.getValue());
final double value = (double) JavaPrimitiveCast.cast(JvmType.Double, right.getValue()); (Double.doubleToRawLongBits(value) & (1L << 63)) != 0; negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, right.getValue()); negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value);
final double value = (double) JavaPrimitiveCast.cast(JvmType.Double, right.getValue()); (Double.doubleToRawLongBits(value) & (1L << 63)) != 0; negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, right.getValue()); negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value);
final double value = (double) JavaPrimitiveCast.cast(JvmType.Double, right.getValue()); (Double.doubleToRawLongBits(value) & (1L << 63)) != 0; negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value); final long value = (long) JavaPrimitiveCast.cast(JvmType.Long, right.getValue()); negatedValue = (Number) JavaPrimitiveCast.cast(JvmType.forValue(right.getValue(), true), -value);
@Override public ResolveResult visitCastExpression(final CastExpression node, final Void data) { final ResolveResult childResult = node.getExpression().acceptVisitor(this, data); final ResolveResult typeResult = resolveType(node.getType()); if (typeResult == null) { return childResult; } final TypeReference resolvedType = typeResult.getType(); if (resolvedType != null) { if (resolvedType.isPrimitive() && childResult != null && childResult.isCompileTimeConstant()) { return new PrimitiveResolveResult( resolvedType, JavaPrimitiveCast.cast(resolvedType.getSimpleType(), childResult.getConstantValue()) ); } return new ResolveResult(resolvedType); } return typeResult; }
@Override public ResolveResult visitCastExpression(final CastExpression node, final Void data) { final ResolveResult childResult = node.getExpression().acceptVisitor(this, data); final ResolveResult typeResult = resolveType(node.getType()); if (typeResult == null) { return childResult; } final TypeReference resolvedType = typeResult.getType(); if (resolvedType != null) { if (resolvedType.isPrimitive() && childResult != null && childResult.isCompileTimeConstant()) { return new PrimitiveResolveResult( resolvedType, JavaPrimitiveCast.cast(resolvedType.getSimpleType(), childResult.getConstantValue()) ); } return new ResolveResult(resolvedType); } return typeResult; }