public @interface Nullable
@Nullable
is a type annotation that indicates that the value is
not known to be non-null (see NonNull
). Another perspective is
that if a type is annotated with Nullable
, then it can be
legal/expected for a value of that type to be null.
For example, if a method parameter's type is annotated with
@Nullable
, then passing null
as an argument should not
by itself cause the method to throw an exception, including a
NullPointerException
. Similarly, if a field's type is
@Nullable
, then setting it to null should not by itself cause a
run-time exception.
No more than one of Nullable
and NonNull
may be
written on a given type.
This annotation is associated with the NullnessChecker
.
NonNull
,
NullnessChecker