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 Details

    • instance

      public static TrustingNullnessAnalysis instance​(com.sun.tools.javac.util.Context context)
      Retrieve an instance of TrustingNullnessAnalysis from the context. If there is no TrustingNullnessAnalysis currently in the context, 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 the Nullness of the leaf of exprPath.

      If the leaf required the compiler to generate autoboxing or autounboxing calls, getNullness returns the Nullness after the boxing/unboxing. This implies that, in those cases, it will always return NONNULL.

    • getFieldInitializerNullness

      public Nullness getFieldInitializerNullness​(com.sun.source.util.TreePath fieldDeclPath, com.sun.tools.javac.util.Context context)
      Returns Nullness of the initializer of the VariableTree at the leaf of the given fieldDeclPath. Returns Nullness.NULL should there be no initializer.
    • hasNullableAnnotation

      public static boolean hasNullableAnnotation​(com.sun.tools.javac.code.Symbol symbol)