Package org.jetbrains.annotations
Annotation Type UnknownNullability
-
@Documented @Retention(CLASS) @Target(TYPE_USE) public @interface UnknownNullabilityAn element annotated withUnknownNullabilityclaims 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@UnknownNullabilityas well). It's mainly useful at method return types to mark methods that may occasionally returnnullbut in many cases, user knows that in this particular code pathnullis not possible, so producing a warning would be annoying.The
UnknownNullabilityis 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.