Annotation Type 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 isnull
. Equivalently, the type includes thenull
value.The Nullness Checker issues an error if
null
is assigned an expression ofNonNull
type.Programmers typically write
@Nullable
to indicate that the value is not known to beNonNull
. However, since@Nullable
is a supertype of@NonNull
, an expression that never evaluates tonull
can have a declared type of@Nullable
.- See Also:
NonNull
,MonotonicNonNull
,NullnessChecker
- See the Checker Framework Manual:
- Nullness Checker