Package org.jetbrains.annotations
Annotation Interface UnknownNullability
An element annotated with
UnknownNullability
claims that no specific nullability
should be assumed by static analyzer. The unconditional dereference of the annotated value
should not trigger a static analysis warning by default (though static analysis tool may have
an option to perform stricter analysis and issue warnings for @UnknownNullability
as well).
It's mainly useful at method return types to mark methods that may occasionally
return null
but in many cases, user knows that in this particular code path
null
is not possible, so producing a warning would be annoying.
The UnknownNullability
is the default nullability for unannotated methods, so it's
rarely necessary. An explicit annotation may serve to document the method behavior and also
to override automatic annotation inference result that could be implemented in some static
analysis tools. Finally, it can override the effect of NotNullByDefault
.
- Since:
- 21.0.0
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
- Returns:
- textual reason when the annotated value could be null, for documentation purposes.
- Default:
""
-