Class NullnessUtils
java.lang.Object
com.google.errorprone.bugpatterns.nullness.NullnessUtils
Static utility methods for common functionality in the nullable checkers.
- Author:
- awturner@google.com (Andy Turner)
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanhasDefinitelyNullBranch(ExpressionTree tree, Set<com.sun.tools.javac.code.Symbol.VarSymbol> definitelyNullVars, com.google.common.collect.ImmutableSet<Name> varsProvenNullByParentIf, VisitorState stateForCompilationUnit) Returnstrueif the given expression can definitely evaluate tonullalong at least one execution branch (for example, explicitnullliterals, conditional/ternary branches returningnull, known-null variables, or calls to methods likeOptional.orNull()).static com.google.common.collect.ImmutableSet<Name> Returns x if the path's leaf is inside(x == null) ? ... : ....
-
Method Details
-
hasDefinitelyNullBranch
public static boolean hasDefinitelyNullBranch(ExpressionTree tree, Set<com.sun.tools.javac.code.Symbol.VarSymbol> definitelyNullVars, com.google.common.collect.ImmutableSet<Name> varsProvenNullByParentIf, VisitorState stateForCompilationUnit) Returnstrueif the given expression can definitely evaluate tonullalong at least one execution branch (for example, explicitnullliterals, conditional/ternary branches returningnull, known-null variables, or calls to methods likeOptional.orNull()). -
varsProvenNullByParentTernary
-