Merge pull request #2584 from aschackmull/java/nonnull-final-field

Java: Include non-null final fields in clearlyNotNull.
This commit is contained in:
yo-h
2020-01-09 18:48:45 -05:00
committed by GitHub
5 changed files with 27 additions and 0 deletions

View File

@@ -101,6 +101,12 @@ predicate clearlyNotNull(SsaVariable v, Expr reason) {
v.(SsaImplicitInit).captures(captured) and
clearlyNotNull(captured, reason)
)
or
exists(Field f |
v.getSourceVariable().getVariable() = f and
f.isFinal() and
f.getInitializer() = clearlyNotNullExpr(reason)
)
}
/** Gets an expression that is provably not `null`. */