Java: Fix bug in ConstantExpAppearsNonConstant.

This commit is contained in:
Anders Schack-Mulligen
2025-10-08 10:32:51 +02:00
parent 28fe20e3e4
commit 99f5dcaaa4

View File

@@ -19,7 +19,7 @@ predicate isConstantExp(Expr e) {
// A literal is constant.
e instanceof Literal
or
e instanceof TypeAccess and not e.(TypeAccess).getType() instanceof ErrorType
e instanceof TypeAccess
or
e instanceof ArrayTypeAccess
or
@@ -53,6 +53,7 @@ predicate isConstantExp(Expr e) {
from Expr e
where
isConstantExp(e) and
not e.(TypeAccess).getType() instanceof ErrorType and
exists(Expr child | e.getAChildExpr() = child |
not isConstantExp(child) and
not child instanceof Annotation