I am +1 on that, I think that, among its usage in analysis tools like FindBugs, it helps very much in code readability, also major IDEs support that and it's therefore easier not to mess up with e.g. some API having not to return null and the likes.
My 2 cents, Tommaso 2015-01-30 13:15 GMT+01:00 Konrad Windszus <[email protected]>: > 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 > >
