Description
Since consumers of the Sling API always have to keep in mind whether a null-check is necessary it would be good to add JSR 305 annotations to the API.
See also http://www.mail-archive.com/dev@sling.apache.org/msg42199.html.
At least Eclipse as well as Findbugs are supporting those and Oak Solr is using those already (https://issues.apache.org/jira/browse/OAK-2303).
Only the following 2 annotations should be used:
- @Nonnull, for return values which are not supposed to be null or parameters which must not be null.
- @CheckForNull, for return values wich may be null null.
Those are the only ones being supported by both Eclipse and Findbugs (compare with http://sourceforge.net/p/findbugs/bugs/1355/)
@Nullable is basically ignored by Findbugs (http://findbugs.sourceforge.net/manual/annotations.html) and should therefore not be used. The package annotation for the default handling should also not be used (because either @Nullable or @CheckForNull is ignored by Eclipse then.
Attachments
Attachments
Issue Links
- is related to
-
SLING-6609 Fix JSR305 annotations for ValueMap.get
- Resolved
-
SLING-6602 Add JSR305 nullness annotations to AbstractResourceVisitor
- Resolved
-
SLING-6991 Add JSR305 nullness annotations to Sling JCR API
- Resolved
-
SLING-4737 Add JSR305 nullness annotations to Sling Models API
- Closed
-
SLING-5608 Manage version of JSR-305 dependency in Sling parent
- Closed
- is superceded by
-
SLING-7798 Switch from JSR-305 annotations to JetBrains Nullable/NotNull annotations
- Closed
- relates to
-
OAK-37 Use nullability annotation to enforce/document API contract
- Closed
-
SLING-4609 Add JSR305 nullness annotations to Validation API
- Closed