DELTASPIKE-1316 only perform the proxaable check for interceptor annotations


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/1c3a16be
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/1c3a16be
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/1c3a16be

Branch: refs/heads/master
Commit: 1c3a16be161eb2e994df5454f7de3335c3ca1246
Parents: 1f19c0e
Author: Mark Struberg <strub...@apache.org>
Authored: Fri Feb 23 11:30:24 2018 +0100
Committer: Mark Struberg <strub...@apache.org>
Committed: Fri Feb 23 11:30:24 2018 +0100

----------------------------------------------------------------------
 .../core/impl/interceptor/interdyn/AnnotationRule.java    | 10 +++++++++-
 .../core/impl/interceptor/interdyn/InterDynExtension.java |  6 ++++--
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1c3a16be/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/AnnotationRule.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/AnnotationRule.java
 
b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/AnnotationRule.java
index a93177b..4048072 100644
--- 
a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/AnnotationRule.java
+++ 
b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/AnnotationRule.java
@@ -37,10 +37,13 @@ public class AnnotationRule
      */
     private Annotation additionalAnnotation;
 
-    public AnnotationRule(String rule, Annotation interceptorBinding)
+    private boolean requiresProxy;
+
+    public AnnotationRule(String rule, Annotation interceptorBinding, boolean 
requiresProxy)
     {
         this.rule = rule;
         this.additionalAnnotation = interceptorBinding;
+        this.requiresProxy = requiresProxy;
     }
 
     public String getRule()
@@ -52,4 +55,9 @@ public class AnnotationRule
     {
         return additionalAnnotation;
     }
+
+    public boolean requiresProxy()
+    {
+        return requiresProxy;
+    }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1c3a16be/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/InterDynExtension.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/InterDynExtension.java
 
b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/InterDynExtension.java
index 72e54c1..80789bd 100644
--- 
a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/InterDynExtension.java
+++ 
b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/interceptor/interdyn/InterDynExtension.java
@@ -33,6 +33,7 @@ import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.BeforeBeanDiscovery;
 import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.interceptor.InterceptorBinding;
 import java.lang.annotation.Annotation;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -100,7 +101,8 @@ public class InterDynExtension implements Deactivatable, 
Extension
                 match.length() > 0 && annotationClassName.length() > 0)
             {
                 Annotation anno = 
getAnnotationImplementation(annotationClassName);
-                interceptorRules.add(new AnnotationRule(match, anno));
+                boolean requiresProxy = 
anno.annotationType().getAnnotation(InterceptorBinding.class) != null;
+                interceptorRules.add(new AnnotationRule(match, anno, 
requiresProxy));
             }
         }
 
@@ -122,7 +124,7 @@ public class InterDynExtension implements Deactivatable, 
Extension
             {
                 if (beanClassName.matches(rule.getRule()))
                 {
-                    if (!ClassUtils.isProxyableClass(at.getJavaClass()))
+                    if (rule.requiresProxy() && 
!ClassUtils.isProxyableClass(at.getJavaClass()))
                     {
                         logger.info("Skipping unproxyable class " + 
beanClassName +
                                 " even if matches rule=" + rule.getRule());

Reply via email to