@Documented @Retention(value=RUNTIME) @Target(value={TYPE_USE,TYPE_PARAMETER}) @SubtypeOf(value=MonotonicNonNull.class) @QualifierForLiterals(value=STRING) @DefaultQualifierInHierarchy @DefaultFor(value=EXCEPTION_PARAMETER) @UpperBoundFor(typeKinds={PACKAGE,INT,BOOLEAN,CHAR,DOUBLE,FLOAT,LONG,SHORT,BYTE}) public @interface NonNull
NonNull
is a type annotation that indicates that an expression is never null
.
For fields of a class, the NonNull
annotation indicates that this field is never
null
after the class has been fully initialized. Class initialization is
controlled by the Freedom Before Commitment type system, see InitializationChecker
for more details.
For static fields, the NonNull
annotation indicates that this field is never null
after the containing class is initialized.
This annotation is rarely written in source code, because it is the default.
This annotation is associated with the NullnessChecker
.
Nullable
,
MonotonicNonNull
,
NullnessChecker