Skip to content

Commit 2d9b249

Browse files
authored
Merge pull request #20600 from aschackmull/java/constant-exp-fix
Java: Fix bug in ConstantExpAppearsNonConstant.
2 parents 4cc6a07 + 99f5dca commit 2d9b249

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

java/ql/src/Likely Bugs/Arithmetic/ConstantExpAppearsNonConstant.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ predicate isConstantExp(Expr e) {
1919
// A literal is constant.
2020
e instanceof Literal
2121
or
22-
e instanceof TypeAccess and not e.(TypeAccess).getType() instanceof ErrorType
22+
e instanceof TypeAccess
2323
or
2424
e instanceof ArrayTypeAccess
2525
or
@@ -53,6 +53,7 @@ predicate isConstantExp(Expr e) {
5353
from Expr e
5454
where
5555
isConstantExp(e) and
56+
not e.(TypeAccess).getType() instanceof ErrorType and
5657
exists(Expr child | e.getAChildExpr() = child |
5758
not isConstantExp(child) and
5859
not child instanceof Annotation

0 commit comments

Comments
 (0)