Package org.eclipse.jdt.annotation
Annotation Type NonNull
-
@Documented @Retention(CLASS) @Target(TYPE_USE) public @interface NonNull
Qualifier for a reference type in aTYPE_USEposition: The type that has this annotation is intended to not include the valuenull.If annotation based null analysis is enabled using this annotation has two consequences:
- Dereferencing an expression of this type is safe, i.e., no
NullPointerExceptioncan occur at runtime. - An attempt to bind a
nullvalue to an entity (field, local variable, method parameter or method return value) of this type is a compile time error.
- Nullness of the value can be statically determined, the entity is definitely bound from either of:
- the value
null, or - an entity with a
@Nullabletype.
- the value
- Nullness cannot definitely be determined, because different code branches yield different results.
- Nullness cannot be determined, because other program elements are involved for which null annotations are lacking.
Note: Since org.eclipse.jdt.annotation 2.0.0, the
@Targetis{TYPE_USE}. For the old API, see@NonNullin 1.1.0.- Since:
- 1.0
- Dereferencing an expression of this type is safe, i.e., no