Merge pull request #2454 from aschackmull/java/explicit-mul-zero

Java: Allow explicit zero multiplication in java/evaluation-to-constant.
This commit is contained in:
yo-h
2019-12-06 18:13:43 -05:00
committed by GitHub
4 changed files with 28 additions and 9 deletions

View File

@@ -74,6 +74,8 @@ where
not child instanceof Annotation
) and
not e instanceof CompileTimeConstantExpr and
// Exclude explicit zero multiplication.
not e.(MulExpr).getAnOperand().(IntegerLiteral).getIntValue() = 0 and
// Exclude expressions that appear to be disabled deliberately (e.g. `false && ...`).
not e.(AndLogicalExpr).getAnOperand().(BooleanLiteral).getBooleanValue() = false
select e, "Expression always evaluates to the same value."