[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217790#comment-14217790 ] Romain Manni-Bucau commented on DELTASPIKE-783: --- Would mean we break the compatibility with EE 6 containers? 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217791#comment-14217791 ] Gerhard Petracek commented on DELTASPIKE-783: - 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. 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217792#comment-14217792 ] Jozef Hartinger commented on DELTASPIKE-783: Not at all. If the annotation class is not known (EE6) it would be ignored. 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217816#comment-14217816 ] Gerhard Petracek commented on DELTASPIKE-783: - sure - however, we would need to use the cdi 1.1 api at build-time - you can get other cdi 1.1+ usages in easily (which you have to drop later on). i just checked it with wf8 - if we would get rid of 100 000 of such checks, the startup would be ~5ms faster (and even less on faster boxes). every idea to improve deltaspike is very welcome for sure, but imo the potential issues (and at least the initial work to change it) is worse than a startup which is 5ms slower (usually project-specific code like creating test-data,... is the real bottleneck here). 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217824#comment-14217824 ] Romain Manni-Bucau commented on DELTASPIKE-783: --- Well it will break some EE 6 containers since it is not built in. Then you need to provide it (which is already a bad idea since DS is built on top of CDI so API should really be considered provided). Then it means you provide javax.YYY in a webapp and here troubles can start depending the container. 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217870#comment-14217870 ] Jozef Hartinger commented on DELTASPIKE-783: {quote} Well it will break some EE 6 containers since it is not built in. Then you need to provide it (which is already a bad idea since DS is built on top of CDI so API should really be considered provided). Then it means you provide javax.YYY in a webapp and here troubles can start depending the container. {quote} No, you don't. In EE6 environment, where @WithAnnotations is not present, extensions will continue working as they do today. 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217880#comment-14217880 ] Romain Manni-Bucau commented on DELTASPIKE-783: --- [~jharting] how since WithExtensions is RUNTIME so we'll get a ClassNotFoundException in the best case and a NoClassDefFoundError in others. 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217891#comment-14217891 ] Jozef Hartinger commented on DELTASPIKE-783: [~romain.manni-bucau] http://stackoverflow.com/questions/3567413/why-doesnt-a-missing-annotation-cause-a-classnotfoundexception-at-runtime 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217897#comment-14217897 ] Romain Manni-Bucau commented on DELTASPIKE-783: --- [~jharting] I fear it is not portable. You are right using 100% reflection but using bytecode scanning you can still fail if you don't want to allow it which is most of the time what you want for user annotations (= avoid wrong packaging). + IIRC in practise for annotations you get java.lang.TypeNotPresentException lazily 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217919#comment-14217919 ] Jozef Hartinger commented on DELTASPIKE-783: If an annotation is unknown to the runtime it is ignored - this really works portably across all Java runtimes. You won't get an exception no matter if you just load classes and use them or use reflection to inspect them. If a bytecode scanning tool throws an exception on that then it is a bug and it should not be doing it. You may be confusing this with a situation when an annotation type has a member of type Class?. Here, if the annotation is known to the runtime but the member value is not, you get an exception. 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217924#comment-14217924 ] Romain Manni-Bucau commented on DELTASPIKE-783: --- Maybe for TypeNotPresentException but for sure a bytecode scanning tool can see it and then is it a bug if it throws an exception? for this case yes but if that's because you forgot to add a dependency or a class then you are happy to have this feature. 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217945#comment-14217945 ] Jozef Hartinger commented on DELTASPIKE-783: {quote}for sure a bytecode scanning tool can see it and then is it a bug if it throws an exception?{quote} Definitelly! Annotations were designed this way. As a result, Java runtimes *purposely ignore unknown annotations*. If a bytecode scanning tool does not comply with this, causing exceptions in valid applications, then this is a bug. Btw are you sure there is a particular bytecode scanning tool behaving the what you describe or are we just hypothetical here? 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14217957#comment-14217957 ] Romain Manni-Bucau commented on DELTASPIKE-783: --- I understood (BTW thanks for this I didn't know it :)) but we have to leave with existing tools and libraries so I'm not very motivated to do it blindly (ie for a minor). On another side you create a masked dependency which can lead to later issues without a real gain as Gerhard said. 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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)
[jira] [Commented] (DELTASPIKE-783) Use @WithAnnotations
[ https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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 ProcessAnnotatedTypeX event) { if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) { return; } // ... {code} can be extended to: {code:JAVA} X void processAnnotatedType(@Observes @WithAnnotations(Foo.class) ProcessAnnotatedTypeX 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)