java.lang.Object
java.lang.Enum<Nullness>
com.google.errorprone.dataflow.nullnesspropagation.Nullness
All Implemented Interfaces:
Serializable, Comparable<Nullness>, java.lang.constant.Constable, org.checkerframework.errorprone.dataflow.analysis.AbstractValue<Nullness>

public enum Nullness extends Enum<Nullness> implements org.checkerframework.errorprone.dataflow.analysis.AbstractValue<Nullness>
Represents one of the possible nullness values in our nullness analysis.
Author:
deminguyen@google.com (Demi Nguyen)
  • Enum Constant Details

    • NULLABLE

      public static final Nullness NULLABLE
      The lattice for nullness looks like:
              Nullable
             /        \
         Null          Non-null
              \      /
               Bottom
       
    • NULL

      public static final Nullness NULL
    • NONNULL

      public static final Nullness NONNULL
    • BOTTOM

      public static final Nullness BOTTOM
  • Method Details

    • values

      public static Nullness[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Nullness valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • leastUpperBound

      public Nullness leastUpperBound(Nullness other)
      Specified by:
      leastUpperBound in interface org.checkerframework.errorprone.dataflow.analysis.AbstractValue<Nullness>
    • greatestLowerBound

      public Nullness greatestLowerBound(Nullness other)
    • deducedValueWhenNotEqual

      public Nullness deducedValueWhenNotEqual()
      Returns the Nullness that corresponds to what you can deduce by knowing that some expression is not equal to another expression with this Nullness.

      A Nullness represents a set of possible values for a expression. Suppose you have two variables var1 and var2. If var1 != var2, then var1 must be an element of the complement of the singleton set containing the value of var2. If you union these complement sets over all possible values of var2, the set that results is what this method returns, assuming that this is the Nullness of var2.

      Example 1: Suppose nv2 == NULL. Then var2 can have exactly one value, null, and var1 must have a value in the set of all values except null. That set is exactly NONNULL.

      Example 2: Suppose nv2 == NONNULL. Then var2 can have any value except null. Suppose var2 has value "foo". Then var1 must have a value in the set of all values except "foo". Now suppose var2 has value "bar" . Then var1 must have a value in set of all values except "bar". Since we don't know which value in the set NONNULL var2 has, we union all possible complement sets to get the set of all values, or NULLABLE.

    • toString

      public String toString()
      Overrides:
      toString in class Enum<Nullness>