@Documented
@Retention(value=CLASS)
@Target(value={FIELD,METHOD,PARAMETER,LOCAL_VARIABLE})
public @interface NotNull
null
. The specific semantics implied by this
annotation depend on the kind of element the annotation is applied to.
null
. Code writing to the
field or local variable should ensure that a null
reference is never
written.null
for this parameter. The implementation may assume that the value
is never null
, and the behavior of the method if the parameter is
null
is undefined. Overriding methods may optionally use the
Nullable
annotation instead of this annotation for the parameter,
indicating that the overriding method provides additional code to handle a
null
reference passed for the parameter.null
. The
implementation of the method should ensure that a null
reference is
never returned.
The NullUsageProcessor
annotation processor validates certain usage
scenarios for this annotation, with compile-time errors or warnings reported
for misuse. For detailed information about the supported analysis, see the
documentation for NullUsageProcessor
.