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