Class TrustingNullnessAnalysis
java.lang.Object
com.google.errorprone.dataflow.nullnesspropagation.TrustingNullnessAnalysis
- All Implemented Interfaces:
Serializable
public final class TrustingNullnessAnalysis extends Object implements 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:
- Serialized Form
-
Method Summary
Modifier and Type Method Description Nullness
getFieldInitializerNullness(com.sun.source.util.TreePath fieldDeclPath, com.sun.tools.javac.util.Context context)
Nullness
getNullness(com.sun.source.util.TreePath exprPath, com.sun.tools.javac.util.Context context)
Returns theNullness
of the leaf ofexprPath
.static boolean
hasNullableAnnotation(com.sun.tools.javac.code.Symbol symbol)
static TrustingNullnessAnalysis
instance(com.sun.tools.javac.util.Context context)
Retrieve an instance ofTrustingNullnessAnalysis
from thecontext
.
-
Method Details
-
instance
Retrieve an instance ofTrustingNullnessAnalysis
from thecontext
. If there is noTrustingNullnessAnalysis
currently in thecontext
, create one, insert it, and return it. -
getNullness
public Nullness getNullness(com.sun.source.util.TreePath exprPath, com.sun.tools.javac.util.Context context)Returns theNullness
of the leaf ofexprPath
.If the leaf required the compiler to generate autoboxing or autounboxing calls,
getNullness
returns theNullness
after the boxing/unboxing. This implies that, in those cases, it will always returnNONNULL
. -
getFieldInitializerNullness
public Nullness getFieldInitializerNullness(com.sun.source.util.TreePath fieldDeclPath, com.sun.tools.javac.util.Context context)ReturnsNullness
of the initializer of theVariableTree
at the leaf of the givenfieldDeclPath
. ReturnsNullness.NULL
should there be no initializer. -
hasNullableAnnotation
public static boolean hasNullableAnnotation(com.sun.tools.javac.code.Symbol symbol)
-