openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1647826 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/creation/BeanAttributesBuilder.java portable/AbstractAnnotated.java
Date Wed, 24 Dec 2014 18:34:11 GMT
Author: rmannibucau
Date: Wed Dec 24 18:34:11 2014
New Revision: 1647826

URL: http://svn.apache.org/r1647826
Log:
handling @typed in beanAttributes and not AnnotatedType

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java?rev=1647826&r1=1647825&r2=1647826&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
Wed Dec 24 18:34:11 2014
@@ -33,6 +33,7 @@ import javax.enterprise.inject.Alternati
 import javax.enterprise.inject.Any;
 import javax.enterprise.inject.Specializes;
 import javax.enterprise.inject.Stereotype;
+import javax.enterprise.inject.Typed;
 import javax.enterprise.inject.spi.Annotated;
 import javax.enterprise.inject.spi.AnnotatedField;
 import javax.enterprise.inject.spi.AnnotatedMember;
@@ -135,8 +136,41 @@ public abstract class BeanAttributesBuil
         }
         else
         {
-            Set<Type> types = annotated.getTypeClosure();
-            this.types.addAll(types);
+            Typed beanTypes = annotated.getAnnotation(Typed.class);
+            if (beanTypes != null)
+            {
+                Class<?>[] typedTypes = beanTypes.value();
+
+                //New api types
+                Set<Type> newTypes = new HashSet<Type>();
+                for (Class<?> type : typedTypes)
+                {
+                    Type foundType = null;
+
+                    for (Type apiType : annotated.getTypeClosure())
+                    {
+                        if(ClassUtil.getClazz(apiType) == type)
+                        {
+                            foundType = apiType;
+                            break;
+                        }
+                    }
+
+                    if(foundType == null)
+                    {
+                        throw new WebBeansConfigurationException("@Type values must be in
bean api types of class: " + baseType);
+                    }
+
+                    newTypes.add(foundType);
+                }
+
+                this.types.addAll(newTypes);
+                this.types.add(Object.class);
+            }
+            else
+            {
+                this.types.addAll(annotated.getTypeClosure());
+            }
             Set<String> ignored = webBeansContext.getOpenWebBeansConfiguration().getIgnoredInterfaces();
             if (!ignored.isEmpty())
             {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java?rev=1647826&r1=1647825&r2=1647826&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java
Wed Dec 24 18:34:11 2014
@@ -25,13 +25,9 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
-import javax.enterprise.inject.Typed;
 import javax.enterprise.inject.spi.Annotated;
 
 import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.util.AnnotationUtil;
-import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.GenericsUtil;
 
 /**
@@ -168,42 +164,6 @@ abstract class AbstractAnnotated impleme
                     }
                 }
             }
-
-            Annotation[] anns = annotations.toArray(new Annotation[annotations.size()]);
-            if(AnnotationUtil.hasAnnotation(anns, Typed.class))
-            {
-                Typed beanTypes = AnnotationUtil.getAnnotation(anns, Typed.class);
-                Class<?>[] types = beanTypes.value();
-
-                //New api types
-                Set<Type> newTypes = new HashSet<Type>();
-                for(Class<?> type : types)
-                {
-                    Type foundType = null;
-
-                    for(Type apiType : typeClosures)
-                    {
-                        if(ClassUtil.getClazz(apiType) == type)
-                        {
-                            foundType = apiType;
-                            break;
-                        }
-                    }
-
-                    if(foundType == null)
-                    {
-                        throw new WebBeansConfigurationException("@Type values must be in
bean api types of class: " + baseType);
-                    }
-
-                    newTypes.add(foundType);
-                }
-
-                typeClosures.clear();
-                typeClosures.addAll(newTypes);
-
-                typeClosures.add(Object.class);
-            }
-
         }
     }
 



Mime
View raw message