[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14217981#comment-14217981 ]
Jozef Hartinger commented on DELTASPIKE-783: -------------------------------------------- {quote}On another side you create a masked dependency which can lead to later issues without a real gain as Gerhard said.{quote} Yes, how to build this still remain a problem. We can: 1) Use CDI 1.1 API dependency - as Gerhard pointed out this could lead to people pulling in more CDI 1.1 class / interfaces breaking compatibility with EE6 2) Create a special artifact with CDI 1.1 annotations only. This would be safe to compile against as in EE6 those missing annotations would just be ignored. As none of these is straightforward nor nice and the benefit may not justify the problems I am fine with leaving this open for now and revisiting later. > 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)