You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2015/02/02 10:40:34 UTC

[jira] [Commented] (SLING-4377) Add JSR305 annotations to Sling API

    [ https://issues.apache.org/jira/browse/SLING-4377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14301071#comment-14301071 ] 

Konrad Windszus commented on SLING-4377:
----------------------------------------

Since the JSR 305 annotations have a runtime retention, the maven-bundle-plugin generates an import-package statement towards {{javax.annotation}}. This can only be resolved if running in Java 6+, because since Java 6 this is part of the JRE and also exposed from the system bundle. In Oak Solr this is done with the following statement
{code}
Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.6))"
{code}
But how to deal with that in Sling which seems to support Java 1.5 still?
Should we rather remove the import-package statement for that annotation or should we provide an additional bundle exporting {{javax.annotation}}?

> Add JSR305 annotations to Sling API
> -----------------------------------
>
>                 Key: SLING-4377
>                 URL: https://issues.apache.org/jira/browse/SLING-4377
>             Project: Sling
>          Issue Type: Improvement
>          Components: API
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>
> 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 3 annotations should be used:
> # {{@Nonnull}}
> # {{@Nullable}}
> # {{@ParametersAreNonNullByDefault}}
> Those are the only ones being supported by both Eclipse and Findbugs.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)