Annotation Interface Nullable
@Documented
@Retention(RUNTIME)
@Target({TYPE_USE,TYPE_PARAMETER})
@SubtypeOf({})
@QualifierForLiterals(NULL)
@DefaultFor(types=java.lang.Void.class)
public @interface Nullable
Nullable
is a type annotation that makes no commitments about whether the value is
null
. Equivalently, the type includes the null
value.
The Nullness Checker issues an error if null
is assigned an expression of NonNull
type.
Programmers typically write @Nullable
to indicate that the value is not known to be
NonNull
. However, since @Nullable
is a supertype of @NonNull
, an
expression that never evaluates to null
can have a declared type of @Nullable
.
- See Also:
- See the Checker Framework Manual:
- Nullness Checker