@Override public void visitBinaryExpression(BinaryExpressionTree tree) { boolean continueVisit = true; if (tree.is(Tree.Kind.DIVIDE) && isIntOrLong(tree.symbolType())) { continueVisit = checkIntegerDivisionInsideFloatingPointExpression(tree); } if (continueVisit) { super.visitBinaryExpression(tree); } }
@Override public void visitBinaryExpression(BinaryExpressionTree tree) { boolean continueVisit = true; if (tree.is(Tree.Kind.DIVIDE) && isIntOrLong(tree.symbolType())) { continueVisit = checkIntegerDivisionInsideFloatingPointExpression(tree); } if (continueVisit) { super.visitBinaryExpression(tree); } }
private static boolean withinStringConcatenation(BinaryExpressionTree tree) { Tree parent = tree.parent(); while (parent.is(Tree.Kind.PARENTHESIZED_EXPRESSION)) { parent = parent.parent(); } return parent.is(Tree.Kind.PLUS) && ((BinaryExpressionTree) parent).symbolType().is("java.lang.String"); }
private static boolean withinStringConcatenation(BinaryExpressionTree tree) { Tree parent = tree.parent(); while (parent.is(Tree.Kind.PARENTHESIZED_EXPRESSION)) { parent = parent.parent(); } return parent.is(Tree.Kind.PLUS) && ((BinaryExpressionTree) parent).symbolType().is("java.lang.String"); }
@Override public void visitBinaryExpression(BinaryExpressionTree tree) { super.visitBinaryExpression(tree); if (isShifting(tree)) { shifts.add(tree); return; } if (ExpressionUtils.isSecuringByte(tree)) { byteContainments.add(tree); return; } if (isIntegerOrLongExpected(tree.symbolType())) { ExpressionTree leftOperand = ExpressionUtils.skipParentheses(tree.leftOperand()); ExpressionTree rightOperand = ExpressionUtils.skipParentheses(tree.rightOperand()); checkShiftWithoutByteSecuring(leftOperand, rightOperand); checkShiftWithoutByteSecuring(rightOperand, leftOperand); } }
@Override public void visitBinaryExpression(BinaryExpressionTree tree) { super.visitBinaryExpression(tree); if (isShifting(tree)) { shifts.add(tree); return; } if (ExpressionUtils.isSecuringByte(tree)) { byteContainments.add(tree); return; } if (isIntegerOrLongExpected(tree.symbolType())) { ExpressionTree leftOperand = ExpressionUtils.skipParentheses(tree.leftOperand()); ExpressionTree rightOperand = ExpressionUtils.skipParentheses(tree.rightOperand()); checkShiftWithoutByteSecuring(leftOperand, rightOperand); checkShiftWithoutByteSecuring(rightOperand, leftOperand); } }