@Override public Void visitCastExpression(final CastExpression node, final Void data) { final Expression child = node.getExpression(); parenthesizeIfRequired(child, UNARY); if (child instanceof UnaryOperatorExpression) { final UnaryOperatorExpression childUnary = (UnaryOperatorExpression) child; if (childUnary.getOperator() != UnaryOperatorType.BITWISE_NOT && childUnary.getOperator() != UnaryOperatorType.NOT) { if (canTypeBeMisinterpretedAsExpression(node.getType())) { parenthesize(child); } } } if (child instanceof PrimitiveExpression) { final PrimitiveExpression primitive = (PrimitiveExpression) child; final Object primitiveValue = primitive.getValue(); if (primitiveValue instanceof Number) { final Number number = (Number) primitiveValue; if (primitiveValue instanceof Float || primitiveValue instanceof Double) { if (number.doubleValue() < 0d) { parenthesize(child); } } else if (number.longValue() < 0L) { parenthesize(child); } } } return super.visitCastExpression(node, data); }
@Override public Void visitCastExpression(final CastExpression node, final Void data) { final Expression child = node.getExpression(); parenthesizeIfRequired(child, UNARY); if (child instanceof UnaryOperatorExpression) { final UnaryOperatorExpression childUnary = (UnaryOperatorExpression) child; if (childUnary.getOperator() != UnaryOperatorType.BITWISE_NOT && childUnary.getOperator() != UnaryOperatorType.NOT) { if (canTypeBeMisinterpretedAsExpression(node.getType())) { parenthesize(child); } } } if (child instanceof PrimitiveExpression) { final PrimitiveExpression primitive = (PrimitiveExpression) child; final Object primitiveValue = primitive.getValue(); if (primitiveValue instanceof Number) { final Number number = (Number) primitiveValue; if (primitiveValue instanceof Float || primitiveValue instanceof Double) { if (number.doubleValue() < 0d) { parenthesize(child); } } else if (number.longValue() < 0L) { parenthesize(child); } } } return super.visitCastExpression(node, data); }
@Override public Void visitCastExpression(final CastExpression node, final Void data) { final Expression child = node.getExpression(); parenthesizeIfRequired(child, UNARY); if (child instanceof UnaryOperatorExpression) { final UnaryOperatorExpression childUnary = (UnaryOperatorExpression) child; if (childUnary.getOperator() != UnaryOperatorType.BITWISE_NOT && childUnary.getOperator() != UnaryOperatorType.NOT) { if (canTypeBeMisinterpretedAsExpression(node.getType())) { parenthesize(child); } } } if (child instanceof PrimitiveExpression) { final PrimitiveExpression primitive = (PrimitiveExpression) child; final Object primitiveValue = primitive.getValue(); if (primitiveValue instanceof Number) { final Number number = (Number) primitiveValue; if (primitiveValue instanceof Float || primitiveValue instanceof Double) { if (number.doubleValue() < 0d) { parenthesize(child); } } else if (number.longValue() < 0L) { parenthesize(child); } } } return super.visitCastExpression(node, data); }
return super.visitCastExpression(node, data);
return super.visitCastExpression(node, data);
return super.visitCastExpression(node, data);