Class TrustingNullnessAnalysis
java.lang.Object
com.google.errorprone.dataflow.nullnesspropagation.TrustingNullnessAnalysis
- All Implemented Interfaces:
Serializable
An interface to the "trusting" nullness analysis. This variant "trusts"
Nullable
annotations, similar to how a modular nullness checker like the checkerframework's would, meaning
method parameters, fields, and method returns are assumed Nullness.NULLABLE only if
annotated so.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetFieldInitializerNullness(TreePath fieldDeclPath, com.sun.tools.javac.util.Context context) getNullness(TreePath exprPath, com.sun.tools.javac.util.Context context) Returns theNullnessof the leaf ofexprPath.static booleanhasNullableAnnotation(com.sun.tools.javac.code.Symbol symbol) static TrustingNullnessAnalysisinstance(com.sun.tools.javac.util.Context context) Retrieve an instance ofTrustingNullnessAnalysisfrom thecontext.
-
Method Details
-
instance
Retrieve an instance ofTrustingNullnessAnalysisfrom thecontext. If there is noTrustingNullnessAnalysiscurrently in thecontext, create one, insert it, and return it. -
getNullness
Returns theNullnessof the leaf ofexprPath.If the leaf required the compiler to generate autoboxing or autounboxing calls,
getNullnessreturns theNullnessafter the boxing/unboxing. This implies that, in those cases, it will always returnNONNULL. -
getFieldInitializerNullness
public Nullness getFieldInitializerNullness(TreePath fieldDeclPath, com.sun.tools.javac.util.Context context) ReturnsNullnessof the initializer of theVariableTreeat the leaf of the givenfieldDeclPath. ReturnsNullness.NULLshould there be no initializer. -
hasNullableAnnotation
public static boolean hasNullableAnnotation(com.sun.tools.javac.code.Symbol symbol)
-