Package org.antlr.v4.runtime.misc
Annotation Interface Nullable
@Documented
@Retention(CLASS)
@Target({FIELD,METHOD,PARAMETER,LOCAL_VARIABLE})
public @interface Nullable
This annotation marks a field, parameter, local variable, or method (return
value) as potentially having the value
null. The specific semantics
implied by this annotation depend on the kind of element the annotation is
applied to.
- Field or Local Variable: Code reading the field or local
variable may not assume that the value is never
null. - Parameter: Code calling the method might pass
nullfor this parameter. The documentation for the method should describe the behavior of the method in the event this parameter isnull. - Method (Return Value): Code calling the method may not
assume that the result of the method is never
null. The documentation for the method should describe the meaning of anullreference being returned. Overriding methods may optionally use theNotNullannotation instead of this annotation for the method, indicating that the overriding method (and any method which overrides it) will never return anullreference.
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.