Top Description Methods
org.eclipse.jdt.annotation

public @Interface NonNullByDefault

extends Annotation
Annotations
@Documented
@Retention:CLASS
Imports
java.lang.annotation.ElementType, .Documented, .Retention, .RetentionPolicy

Applying this annotation to a declaration has the effect that type references, which are contained in the declaration, and for which a null annotation is otherwise lacking, should be considered as @NonNull.
Locations
This annotation is permitted for these declarations: PACKAGE, TYPE, METHOD, CONSTRUCTOR, FIELD, LOCAL_VARIABLE.
Fine tuning
The exact effect is further controlled by the attribute value, specifying what kinds of locations within the given declaration will be affected. See DefaultLocation for the meaning of the available values.
Nested defaults
If this annotation is applied to a declaration that is already affected by the same annotation at an enclosing scope, the inner annotation replaces the effect of the outer annotation for the scope of the inner declaration.
Canceling a default
In particular, specifying an empty value ({}) for the value attribute has the effect of canceling any null defaults that might be defined for any enclosing scope.

Note that for applying an annotation to a package, a file by the name package-info.java is used.

Note

Since org.eclipse.jdt.annotation 2.0.0, this annotation also applies to field and local variable declarations and since 2.2.0 also to parameter and module declarations. For the old API, see @NonNullByDefault in 1.1.0.

Since
1.0

Method Summary

Modifier and TypeMethod and Description
public DefaultLocation[]

Returns:

the locations, or an empty array to cancel any null defaults from enclosing scopes
value
()

Specifies the set of locations within the annotated declaration that should be affected by the nonnull default.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public DefaultLocation[] value()

Specifies the set of locations within the annotated declaration that should be affected by the nonnull default.

Returns:DefaultLocation[]

the locations, or an empty array to cancel any null defaults from enclosing scopes

Since
2.0