Let me emphasize first that whether to follow this annotation is entirely up to you (there is no parameter verification function)
Click into the annotation source code to see that the @Nullable annotation inherits multiple annotation interfaces . The following analyzes the inherited interfaces in turn:
This annotation indicates what the target of this annotation can be
ElementType.METHOD(Method)
ElementType.PARAMETER(method parameter)
ElementType.FIELD (field, enumeration constant)
Represents the life cycle of annotations
RetentionPolicy.RUNTIME (the annotation is not only saved in the class file, but still exists after jvm loads the class file)
Generated docs are annotated (showing @Nullable)
@NonNull modifies fields, methods, and parameters, so fields cannot be null, method return values cannot be null, and parameters cannot be null.
As for the function of when = When.MAYBE, I speculate that it is only the function of marking (the following is the source code of the annotation @NonNull)
When other annotations use this annotation (@Nullable)
All annotations used by @Nullable ( except @TypeQualifierNickname) will be added
at last,
Hope the article is helpful to you. . .