Author: rmannibucau
Date: Sun Jun 29 08:08:53 2014
New Revision: 1606442

URL: http://svn.apache.org/r1606442
Log:
annotatedtype queried with null are actually internal annotated types + 
getAnnotations shouldn't return 2 scopes (super one should be skipped)

Modified:
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java
    openwebbeans/trunk/webbeans-tck/testng-dev.xml

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1606442&r1=1606441&r2=1606442&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
 Sun Jun 29 08:08:53 2014
@@ -1166,6 +1166,11 @@ public class BeanManagerImpl implements 
 
     public <T> AnnotatedType<T> getAdditionalAnnotatedType(Class<T> type, 
String id)
     {
+        if (id == null)
+        {
+            return annotatedElementFactory.getAnnotatedType(type);
+        }
+
         ConcurrentMap<String, AnnotatedType<?>> annotatedTypes = 
additionalAnnotatedTypes.get(type);
         if (annotatedTypes == null)
         {

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java?rev=1606442&r1=1606441&r2=1606442&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java
 Sun Jun 29 08:08:53 2014
@@ -35,6 +35,7 @@ import javax.enterprise.inject.spi.Annot
 import javax.enterprise.inject.spi.AnnotatedField;
 import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
 import javax.interceptor.AroundConstruct;
 import javax.interceptor.AroundInvoke;
 
@@ -80,20 +81,28 @@ class AnnotatedTypeImpl<X>
         }
         else
         {
+            final BeanManager bm = webBeansContext.getBeanManagerImpl();
             Set<Class<? extends Annotation>> annotationTypes = new 
HashSet<Class<? extends Annotation>>();
             List<Annotation> annotations = new ArrayList<Annotation>();
+            boolean hasScope = false;
             for (Annotation annotation : 
annotatedClass.getDeclaredAnnotations())
             {
+                if (bm.isScope(annotation.annotationType()))
+                {
+                    hasScope = true;
+                }
                 annotations.add(annotation);
                 annotationTypes.add(annotation.annotationType());
             }
             for (Annotation annotation : supertype.getAnnotations())
             {
-                if 
(annotation.annotationType().isAnnotationPresent(Inherited.class) &&
-                    !annotationTypes.contains(annotation.annotationType()))
+                final Class<? extends Annotation> annotationType = 
annotation.annotationType();
+                if (annotationType.isAnnotationPresent(Inherited.class)
+                    && !annotationTypes.contains(annotationType)
+                    && (!bm.isScope(annotationType) || !hasScope))
                 {
                     annotations.add(annotation);
-                    annotationTypes.add(annotation.annotationType());
+                    annotationTypes.add(annotationType);
                 }
             }
             setAnnotations(annotations.toArray(new 
Annotation[annotations.size()]));

Modified: openwebbeans/trunk/webbeans-tck/testng-dev.xml
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/testng-dev.xml?rev=1606442&r1=1606441&r2=1606442&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/testng-dev.xml (original)
+++ openwebbeans/trunk/webbeans-tck/testng-dev.xml Sun Jun 29 08:08:53 2014
@@ -19,7 +19,7 @@
   <test name="JSR-346 TCK">
     <classes>
       <class
-          
name="org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct.ConstructorInterceptionTest"/>
+          
name="org.jboss.cdi.tck.tests.extensions.alternative.metadata.annotated.AnnotatedTypeAnnotationsTest"/>
     </classes>
     <groups>
       <run>


Reply via email to