[cdi-dev] [JBoss JIRA] (CDI-43) Allow Extensions to specify the annotations that they are interested in
Pete Muir (JIRA)
jira-events at lists.jboss.org
Fri Aug 17 11:22:15 EDT 2012
[ https://issues.jboss.org/browse/CDI-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12712252#comment-12712252 ]
Pete Muir edited comment on CDI-43 at 8/17/12 11:21 AM:
--------------------------------------------------------
Stuart proposes adding something http://docs.oracle.com/javaee/6/api/javax/servlet/annotation/HandlesTypes.html
{quote}
If an implementation of ServletContainerInitializer specifies this annotation, the Servlet container must pass the Set of application classes that extend, implement, or have been annotated with the class types listed by this annotation to the ServletContainerInitializer.onStartup(java.util.Set>, javax.servlet.ServletContext) method of the ServletContainerInitializer (if no matching classes are found, null must be passed instead)
{quote}
Note that the annotation could appear anywhere on the class that the extension is interested in.
This annotation should be @Retention(CLASS), so that it *is* available to libraries that directly read the bytecode but *isn't* available to the JVM to cause potential classloading issues.
This means that, for extensions that use this annotation, there is no need to fully load the class for every bean, and instead only load classes that the extension expresses an interest in (discovered by scanning the bytecode rather than via reflection).
Note that if even one extension doesn't use this feature, the performance benefit is lost.
was (Author: pmuir):
Stuart proposes adding something http://docs.oracle.com/javaee/6/api/javax/servlet/annotation/HandlesTypes.html
{quote}
If an implementation of ServletContainerInitializer specifies this annotation, the Servlet container must pass the Set of application classes that extend, implement, or have been annotated with the class types listed by this annotation to the ServletContainerInitializer.onStartup(java.util.Set>, javax.servlet.ServletContext) method of the ServletContainerInitializer (if no matching classes are found, null must be passed instead)
{quote}
Note that the annotation could appear anywhere on the class that the extension is interested in.
This annotation should be @Retention(CLASS), so that it *is* available to libraries that directly read the bytecode but *isn't* available to the JVM to cause potential classloading issues.
This means that, for extensions that use this annotation, there is no need to fully load the class for every bean, and instead only load classes that the extension expresses an interest in.
> Allow Extensions to specify the annotations that they are interested in
> -----------------------------------------------------------------------
>
> Key: CDI-43
> URL: https://issues.jboss.org/browse/CDI-43
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Portable Extensions
> Affects Versions: 1.0
> Reporter: Stuart Douglas
> Fix For: 1.1 (Proposed)
>
>
> Currently portable extensions that wish to look for a specific annotation have to look through all availible classes in the ProcessAnnotatatedType event, which is quite inefficient. It would be good if extensions could do something like:
> public void processAnnotatedType(@Observes @RequireAnnotations({@Unwraps.class}) ProcessAnnotatedType pat)
> This could allow the container to take advantage of annotation indexing to improve boot time performance, as well as reducing uneeded processing in the observer.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the cdi-dev
mailing list