Java: Reinstate useless null check results for fields that are no longer tracked as SSA variables.

This commit is contained in:
Anders Schack-Mulligen
2025-11-11 15:28:45 +01:00
parent 437ca58e3f
commit 4a58a0158a

View File

@@ -105,6 +105,13 @@ Expr clearlyNotNullExpr(Expr reason) {
result = v.getARead() and
not result = baseNotNullExpr()
)
or
exists(Field f |
result = f.getAnAccess() and
f.isFinal() and
f.getInitializer() = clearlyNotNullExpr(reason) and
not result = baseNotNullExpr()
)
}
/** Holds if `v` is an SSA variable that is provably not `null`. */