Annotation Type NonNull
-
@Documented @Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER}) @SubtypeOf(MonotonicNonNull.class) @DefaultQualifierInHierarchy @QualifierForLiterals(STRING) @DefaultFor(EXCEPTION_PARAMETER) @UpperBoundFor(typeKinds={PACKAGE,INT,BOOLEAN,CHAR,DOUBLE,FLOAT,LONG,SHORT,BYTE}) public @interface NonNull
If an expression's type is qualified by@NonNull
, then the expression never evaluates tonull
. (Unless the program has a bug; annotations specify intended behavior.)For fields of a class, the
NonNull
annotation indicates that this field is nevernull
after the class has been fully initialized. For static fields, theNonNull
annotation indicates that this field is nevernull
after the containing class is initialized. "Fully initialized" essentially means that the Java constructor has completed. See the Initialization Checker documentation for more details.This annotation is rarely written in source code, because it is the default.
- See Also:
Nullable
,MonotonicNonNull
- See the Checker Framework Manual:
- Nullness Checker, Initialization Checker, the bottom type