Enum Nullness
- All Implemented Interfaces:
Serializable
,Comparable<Nullness>
,java.lang.constant.Constable
,org.checkerframework.errorprone.dataflow.analysis.AbstractValue<Nullness>
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns theNullness
that corresponds to what you can deduce by knowing that some expression is not equal to another expression with thisNullness
.greatestLowerBound
(Nullness other) leastUpperBound
(Nullness other) toString()
static Nullness
Returns the enum constant of this type with the specified name.static Nullness[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NULLABLE
The lattice for nullness looks like:Nullable / \ Null Non-null \ / Bottom
-
NULL
-
NONNULL
-
BOTTOM
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
leastUpperBound
-
greatestLowerBound
-
deducedValueWhenNotEqual
Returns theNullness
that corresponds to what you can deduce by knowing that some expression is not equal to another expression with thisNullness
.A
Nullness
represents a set of possible values for a expression. Suppose you have two variablesvar1
andvar2
. Ifvar1 != var2
, thenvar1
must be an element of the complement of the singleton set containing the value ofvar2
. If you union these complement sets over all possible values ofvar2
, the set that results is what this method returns, assuming thatthis
is theNullness
ofvar2
.Example 1: Suppose
nv2 == NULL
. Thenvar2
can have exactly one value,null
, andvar1
must have a value in the set of all values exceptnull
. That set is exactlyNONNULL
.Example 2: Suppose
nv2 == NONNULL
. Thenvar2
can have any value exceptnull
. Supposevar2
has value"foo"
. Thenvar1
must have a value in the set of all values except"foo"
. Now supposevar2
has value"bar"
. Thenvar1
must have a value in set of all values except"bar"
. Since we don't know which value in the setNONNULL var2
has, we union all possible complement sets to get the set of all values, orNULLABLE
. -
toString
-