Skip to content

Commit

Permalink
Revert "NULL_LITERAL expressions may always be null (uber#749)"
Browse files Browse the repository at this point in the history
This reverts commit e4dfeac.
  • Loading branch information
msridhar committed Jul 18, 2023
1 parent f5e2632 commit ad7d15b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nullaway/src/main/java/com/uber/nullaway/NullAway.java
Original file line number Diff line number Diff line change
Expand Up @@ -2197,14 +2197,14 @@ private boolean mayBeNullExpr(VisitorState state, ExpressionTree expr) {
// obviously not null
return false;
}
if (expr.getKind() == Tree.Kind.NULL_LITERAL) {
// obviously null, so same as for above literals we return early without consulting handlers
return true;
}
// the logic here is to avoid doing dataflow analysis whenever possible
Symbol exprSymbol = ASTHelpers.getSymbol(expr);
boolean exprMayBeNull;
switch (expr.getKind()) {
case NULL_LITERAL:
// obviously null
exprMayBeNull = true;
break;
case ARRAY_ACCESS:
// unsound! we cannot check for nullness of array contents yet
exprMayBeNull = false;
Expand Down

0 comments on commit ad7d15b

Please sign in to comment.