[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14217796#comment-14217796 ]
Jozef Hartinger commented on DELTASPIKE-783: -------------------------------------------- {quote} in several cases we check for multiple annotations. i'm not sure about a huge benefit at all. i saw codi as well as ds in huge projects and performance-issues with the startup were never near to the bootstrapping-lifecycle of cdi. however, i just can report it for owb based projects. maybe it's an issue with weld. {quote} Multiple annotations are not a problem. I am not saying the benefit is huge. However, this feature was added to CDI for exactly this reason and it has advantages. If an extension author had two options: a) have our observer method called twice b) have our observer method called 1000 times (998 out which are useless and ignored and two calls that actually do something) I do not see why an extension author would choose (b) > Use @WithAnnotations > -------------------- > > Key: DELTASPIKE-783 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-783 > Project: DeltaSpike > Issue Type: Improvement > Affects Versions: 1.1.0 > Reporter: Jozef Hartinger > > Make use of CDI's @WithAnnotations feature. > Each extension that does something like: > {code:JAVA} > <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> event) { > if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { > return; > } > // ... > {code} > can be extended to: > {code:JAVA} > <X> void processAnnotatedType(@Observes @WithAnnotations(Foo.class) > ProcessAnnotatedType<X> event) { > if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { > return; > } > // ... > {code} > This can yield performance boost in CDI 1.1+ environment because: > 1) the observer method will be only called for annotated types that have the > annotation, not for all the types in the deployment > 2) the container may not event need to load the annotated type and its class > at all if there are no observers requesting the type and the type does not > represent a bean. > In addition, this works nice in CDI 1.0 environment where the class > definition for the annotation is not be found and is ignored. -- This message was sent by Atlassian JIRA (v6.3.4#6332)