Hi,
the Sling API sometimes forces the developer to check for null results e.g. 
SlingAdaptable.adaptTo and ResourceResolver.getResource.
This is very often forgotten by users of that API.
I would really appreciate if we would start annotating the Sling API with 
JSR305 annotations (https://jcp.org/en/jsr/detail?id=305 
<https://jcp.org/en/jsr/detail?id=305>). Although the JSR is dormant since 2012 
(http://stackoverflow.com/questions/2289694/what-is-the-status-of-jsr-305 
<http://stackoverflow.com/questions/2289694/what-is-the-status-of-jsr-305>) it 
is supported by FindBugs (http://findbugs.sourceforge.net/findbugs2.html 
<http://findbugs.sourceforge.net/findbugs2.html>) and the annotations are used 
also in Apache Oak (https://issues.apache.org/jira/browse/OAK-2303 
<https://issues.apache.org/jira/browse/OAK-2303>). I don’t know of a better 
approach for supporting tools to check for those violations.
What about adding annotations like 
https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java
 
<https://code.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/CheckForNull.java>
 to the Sling API?
Thanks for your input,
Konrad

Reply via email to