[webbeans-commits] Webbeans SVN: r1083 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean and 7 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Mon Jan 19 10:58:59 EST 2009


Author: pete.muir at jboss.org
Date: 2009-01-19 10:58:59 -0500 (Mon, 19 Jan 2009)
New Revision: 1083

Modified:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java
Log:
Fix scope inheritance

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -261,7 +261,7 @@
     */
    public <T> Set<Bean<T>> resolveByType(Class<T> type, Annotation... bindings)
    {
-      return resolveByType(new AnnotatedClassImpl<T>(type, type, bindings), bindings);
+      return resolveByType(AnnotatedClassImpl.of(type, bindings), bindings);
    }
 
    /**
@@ -276,7 +276,7 @@
     */
    public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> type, Annotation... bindings)
    {
-      return resolveByType(new AnnotatedClassImpl<T>(type.getRawType(), type.getType(), bindings), bindings);
+      return resolveByType(AnnotatedClassImpl.of(type, bindings), bindings);
    }
 
    /**
@@ -564,7 +564,7 @@
     */
    public <T> T getInstanceByType(Class<T> type, Annotation... bindings)
    {
-      return getInstanceByType(new AnnotatedClassImpl<T>(type, type, bindings), bindings);
+      return getInstanceByType(AnnotatedClassImpl.of(type, bindings), bindings);
    }
 
    public <T> T getMostSpecializedInstance(Bean<T> bean, boolean create)
@@ -592,7 +592,7 @@
     */
    public <T> T getInstanceByType(TypeLiteral<T> type, Annotation... bindings)
    {
-      return getInstanceByType(new AnnotatedClassImpl<T>(type.getRawType(), type.getType(), bindings), bindings);
+      return getInstanceByType(AnnotatedClassImpl.of(type, bindings), bindings);
    }
 
    /**

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -32,7 +32,6 @@
 import javax.webbeans.Event;
 import javax.webbeans.InjectionPoint;
 import javax.webbeans.Named;
-import javax.webbeans.ScopeType;
 import javax.webbeans.Specializes;
 import javax.webbeans.Standard;
 import javax.webbeans.Stereotype;
@@ -287,33 +286,25 @@
    /**
     * Initializes the scope type
     */
-   protected void initScopeType()
+   protected abstract void initScopeType();
+   
+   protected boolean initScopeFromStereotype()
    {
-      Set<Annotation> scopeAnnotations = getAnnotatedItem().getMetaAnnotations(ScopeType.class);
-      if (scopeAnnotations.size() > 1)
-      {
-         throw new DefinitionException("At most one scope may be specified");
-      }
-      if (scopeAnnotations.size() == 1)
-      {
-         this.scopeType = scopeAnnotations.iterator().next().annotationType();
-         log.trace("Scope " + scopeType + " specified by annotation");
-         return;
-      }
-
       Set<Annotation> possibleScopeTypes = getMergedStereotypes().getPossibleScopeTypes();
       if (possibleScopeTypes.size() == 1)
       {
          this.scopeType = possibleScopeTypes.iterator().next().annotationType();
          log.trace("Scope " + scopeType + " specified by stereotype");
-         return;
+         return true;
       }
       else if (possibleScopeTypes.size() > 1)
       {
          throw new DefinitionException("All stereotypes must specify the same scope OR a scope must be specified on the bean");
       }
-      this.scopeType = Dependent.class;
-      log.trace("Using default @Dependent scope");
+      else
+      {
+         return false;
+      }
    }
 
    /**

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -23,12 +23,14 @@
 
 import javax.webbeans.BindingType;
 import javax.webbeans.DefinitionException;
+import javax.webbeans.Dependent;
 import javax.webbeans.Destructor;
 import javax.webbeans.Disposes;
 import javax.webbeans.Initializer;
 import javax.webbeans.Observes;
 import javax.webbeans.Produces;
 import javax.webbeans.Production;
+import javax.webbeans.ScopeType;
 
 import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.introspector.AnnotatedClass;
@@ -150,6 +152,44 @@
          }
       }
    }
+   
+   @Override
+   protected void initScopeType()
+   {
+      Set<Annotation> scopeAnnotations = getAnnotatedItem().getMetaAnnotations(ScopeType.class);
+      if (scopeAnnotations.size() == 1)
+      {
+         this.scopeType = scopeAnnotations.iterator().next().annotationType();
+         log.trace("Scope " + scopeType + " specified by annotation");
+         return;
+      }
+      else if (scopeAnnotations.size() > 1)
+      {
+         for (AnnotatedClass<?> clazz = getAnnotatedItem(); clazz != null; clazz = clazz.getSuperclass())
+         {
+            scopeAnnotations = clazz.getDeclaredMetaAnnotations(ScopeType.class);
+            if (scopeAnnotations.size() == 1)
+            {
+               this.scopeType = scopeAnnotations.iterator().next().annotationType();
+               log.trace("Scope " + scopeType + " specified by annotation");
+               return;
+            }
+            else if (scopeAnnotations.size() > 1)
+            {
+               throw new DefinitionException("At most one scope may be specified");
+            }
+         }
+         
+      }
+      
+      initScopeFromStereotype();
+      
+      if (this.scopeType == null)
+      {
+         this.scopeType = Dependent.class;
+         log.trace("Using default @Dependent scope");
+      }
+   }
 
    /**
     * Validate that the scope type is allowed by the stereotypes on the bean and

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -21,17 +21,21 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.util.HashSet;
+import java.util.Set;
 
 import javax.webbeans.DefinitionException;
 import javax.webbeans.Dependent;
 import javax.webbeans.IllegalProductException;
 import javax.webbeans.Initializer;
 import javax.webbeans.Produces;
+import javax.webbeans.ScopeType;
 
 import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.MetaDataCache;
 import org.jboss.webbeans.context.DependentContext;
 import org.jboss.webbeans.injection.InjectionPointImpl;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
 import org.jboss.webbeans.util.Names;
 import org.jboss.webbeans.util.Reflections;
 
@@ -47,6 +51,8 @@
 {
    // The declaring bean
    protected AbstractClassBean<?> declaringBean;
+   
+   private static final LogProvider log = Logging.getLogProvider(AbstractProducerBean.class);
 
    /**
     * Constructor
@@ -200,6 +206,30 @@
          }
       }
    }
+   
+   @Override
+   protected void initScopeType()
+   {
+      Set<Annotation> scopeAnnotations = getAnnotatedItem().getMetaAnnotations(ScopeType.class);
+      if (scopeAnnotations.size() > 1)
+      {
+         throw new DefinitionException("At most one scope may be specified");
+      }
+      if (scopeAnnotations.size() == 1)
+      {
+         this.scopeType = scopeAnnotations.iterator().next().annotationType();
+         log.trace("Scope " + scopeType + " specified by annotation");
+         return;
+      }
+      
+      initScopeFromStereotype();
+      
+      if (this.scopeType == null)
+      {
+         this.scopeType = Dependent.class;
+         log.trace("Using default @Dependent scope");
+      }
+   }
 
    /**
     * Gets the receiver of the product

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -192,7 +192,7 @@
    
    private <T> void createSimpleBean(Class<T> clazz, Set<AbstractBean<?, ?>> beans)
    {
-      AnnotatedClass<T> annotatedClass = new AnnotatedClassImpl<T>(clazz);
+      AnnotatedClass<T> annotatedClass = AnnotatedClassImpl.of(clazz);
       createBean(SimpleBean.of(annotatedClass, manager), annotatedClass, beans);
    }
 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -108,9 +108,9 @@
    public Set<AnnotatedMethod<?>> getMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
 
    /**
-    * Gets the superclass
+    * Gets the superclass.
     * 
-    * @return The abstracted superclass
+    * @return The abstracted superclass, null if there is no superclass
     */
    public AnnotatedClass<?> getSuperclass();
 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -299,7 +299,7 @@
    
    public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
    {
-      return Collections.unmodifiableSet(metaAnnotationMap.get(metaAnnotationType));
+      return Collections.unmodifiableSet(declaredMetaAnnotationMap.get(metaAnnotationType));
    }
 
    /**

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -31,6 +31,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.webbeans.TypeLiteral;
+
 import org.jboss.webbeans.introspector.AnnotatedClass;
 import org.jboss.webbeans.introspector.AnnotatedConstructor;
 import org.jboss.webbeans.introspector.AnnotatedField;
@@ -51,7 +53,7 @@
  */
 public class AnnotatedClassImpl<T> extends AbstractAnnotatedType<T> implements AnnotatedClass<T>
 {
-
+   
    /**
     * A (annotation type -> set of field abstractions with annotation/meta
     * annotation) map
@@ -59,31 +61,31 @@
    private static class AnnotatedFieldMap extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedField<?>>>
    {
       private Map<Class<? extends Annotation>, Set<AnnotatedField<?>>> delegate;
-
+      
       public AnnotatedFieldMap()
       {
          delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<?>>>();
       }
-
+      
       @Override
       protected Map<Class<? extends Annotation>, Set<AnnotatedField<?>>> delegate()
       {
          return delegate;
       }
-
+      
       @Override
       public String toString()
       {
          return Strings.mapToString("AnnotatedFieldMap (annotation type -> field abstraction set): ", delegate);
       }
-
+      
       @Override
       public Set<AnnotatedField<?>> get(Object key)
       {
          Set<AnnotatedField<?>> fields = super.get(key);
          return fields != null ? fields : new HashSet<AnnotatedField<?>>();
       }
-
+      
       public void put(Class<? extends Annotation> key, AnnotatedField<?> value)
       {
          Set<AnnotatedField<?>> fields = super.get(key);
@@ -94,40 +96,40 @@
          }
          fields.add(value);
       }
-
+      
    }
-
+   
    /**
     * A (annotation type -> set of method abstractions with annotation) map
     */
    private class AnnotatedMethodMap extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedMethod<?>>>
    {
       private Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> delegate;
-
+      
       public AnnotatedMethodMap()
       {
          delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedMethod<?>>>();
       }
-
+      
       @Override
       protected Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> delegate()
       {
          return delegate;
       }
-
+      
       @Override
       public String toString()
       {
          return Strings.mapToString("AnnotatedMethodMap (annotation type -> method abstraction set): ", delegate);
       }
-
+      
       @Override
       public Set<AnnotatedMethod<?>> get(Object key)
       {
          Set<AnnotatedMethod<?>> methods = super.get(key);
          return methods != null ? methods : new HashSet<AnnotatedMethod<?>>();
       }
-
+      
       public void put(Class<? extends Annotation> key, AnnotatedMethod<?> value)
       {
          Set<AnnotatedMethod<?>> methods = super.get(key);
@@ -138,40 +140,40 @@
          }
          methods.add(value);
       }
-
+      
    }
-
+   
    /**
     * A (annotation type -> set of constructor abstractions with annotation) map
     */
    private class AnnotatedConstructorMap extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>
    {
       private Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> delegate;
-
+      
       public AnnotatedConstructorMap()
       {
          delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>();
       }
-
+      
       @Override
       protected Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> delegate()
       {
          return delegate;
       }
-
+      
       @Override
       public String toString()
       {
          return Strings.mapToString("AnnotatedConstructorMap (annotation type -> constructor abstraction set): ", delegate);
       }
-
+      
       @Override
       public Set<AnnotatedConstructor<T>> get(Object key)
       {
          Set<AnnotatedConstructor<T>> constructors = super.get(key);
          return constructors != null ? constructors : new HashSet<AnnotatedConstructor<T>>();
       }
-
+      
       public void add(Class<? extends Annotation> key, AnnotatedConstructor<T> value)
       {
          Set<AnnotatedConstructor<T>> constructors = super.get(key);
@@ -183,7 +185,7 @@
          constructors.add(value);
       }
    }
-
+   
    /**
     * A (class list -> set of constructor abstractions with matching parameters)
     * map
@@ -191,18 +193,18 @@
    private class ConstructorsByArgumentMap extends ForwardingMap<List<Class<?>>, AnnotatedConstructor<T>>
    {
       private Map<List<Class<?>>, AnnotatedConstructor<T>> delegate;
-
+      
       public ConstructorsByArgumentMap()
       {
          delegate = new HashMap<List<Class<?>>, AnnotatedConstructor<T>>();
       }
-
+      
       @Override
       protected Map<List<Class<?>>, AnnotatedConstructor<T>> delegate()
       {
          return delegate;
       }
-
+      
       @Override
       public String toString()
       {
@@ -214,45 +216,53 @@
    private final Class<T> clazz;
    // The type arguments
    private final Type[] actualTypeArguments;
-
+   
    // The set of abstracted fields
    private final Set<AnnotatedField<?>> fields;
    // The map from annotation type to abstracted field with annotation
    private final AnnotatedFieldMap annotatedFields;
    // The map from annotation type to abstracted field with meta-annotation
    private final AnnotatedFieldMap metaAnnotatedFields;
-
+   
    // The set of abstracted methods
    private final Set<AnnotatedMethod<?>> methods;
    // The map from annotation type to abstracted method with annotation
    private final AnnotatedMethodMap annotatedMethods;
    // The map from annotation type to method with a parameter with annotation
    private final AnnotatedMethodMap methodsByAnnotatedParameters;
-
+   
    // The set of abstracted constructors
    private final Set<AnnotatedConstructor<T>> constructors;
    // The map from annotation type to abstracted constructor with annotation
    private final AnnotatedConstructorMap annotatedConstructors;
    // The map from class list to abstracted constructor
    private final ConstructorsByArgumentMap constructorsByArgumentMap;
-
+   
    // Cached string representation
    private String toString;
    
+   public static <T> AnnotatedClass<T> of(Class<T> clazz)
+   {
+      return new AnnotatedClassImpl<T>(clazz, clazz, clazz.getAnnotations(), clazz.getDeclaredAnnotations());
+   }
+   
+   // TODO Introduce a lightweight implementation for resolution
+   @Deprecated
+   public static <T> AnnotatedClassImpl<T> of(TypeLiteral<T> typeLiteral, Annotation[] annotations)
+   {
+      return new AnnotatedClassImpl<T>(typeLiteral.getRawType(), typeLiteral.getType(), annotations, annotations);
+   }
+   
+   // TODO Introduce a lightweight implementation for resolution
+   @Deprecated
+   public static <T> AnnotatedClassImpl<T> of(Class<T> clazz, Annotation[] annotations)
+   {
+      return new AnnotatedClassImpl<T>(clazz, clazz, annotations, annotations);
+   }
 
-   /**
-    * Constructor
-    * 
-    * Initializes superclass with built annotation map, sets the raw type and
-    * determines the actual type arguments
-    * 
-    * @param rawType The raw type of the class
-    * @param type The type of the class
-    * @param annotations The array of annotations on the class
-    */
-   public AnnotatedClassImpl(Class<T> rawType, Type type, Annotation[] annotations)
+   private AnnotatedClassImpl(Class<T> rawType, Type type, Annotation[] annotations, Annotation[] declaredAnnotations)
    {
-      super(buildAnnotationMap(annotations), rawType);
+      super(buildAnnotationMap(annotations), buildAnnotationMap(declaredAnnotations), rawType);
       this.clazz = rawType;
       if (type instanceof ParameterizedType)
       {
@@ -262,7 +272,7 @@
       {
          actualTypeArguments = new Type[0];
       }
-
+      
       this.fields = new HashSet<AnnotatedField<?>>();
       this.annotatedFields = new AnnotatedFieldMap();
       this.metaAnnotatedFields = new AnnotatedFieldMap();
@@ -284,10 +294,10 @@
                   this.metaAnnotatedFields.put(metaAnnotation.annotationType(), annotatedField);
                }
             }
-
+            
          }
       }
-
+      
       this.constructors = new HashSet<AnnotatedConstructor<T>>();
       this.constructorsByArgumentMap = new ConstructorsByArgumentMap();
       this.annotatedConstructors = new AnnotatedConstructorMap();
@@ -302,7 +312,7 @@
          }
          this.constructors.add(annotatedConstructor);
          this.constructorsByArgumentMap.put(Arrays.asList(constructor.getParameterTypes()), annotatedConstructor);
-
+         
          for (Annotation annotation : annotatedConstructor.getAnnotations())
          {
             if (!annotatedConstructors.containsKey(annotation.annotationType()))
@@ -312,7 +322,7 @@
             annotatedConstructors.get(annotation.annotationType()).add(annotatedConstructor);
          }
       }
-
+      
       this.methods = new HashSet<AnnotatedMethod<?>>();
       this.annotatedMethods = new AnnotatedMethodMap();
       this.methodsByAnnotatedParameters = new AnnotatedMethodMap();
@@ -324,7 +334,7 @@
             {
                method.setAccessible(true);
             }
-
+            
             AnnotatedMethod<?> annotatedMethod = new AnnotatedMethodImpl<Object>(method, this);
             this.methods.add(annotatedMethod);
             for (Annotation annotation : annotatedMethod.getAnnotations())
@@ -345,25 +355,8 @@
          }
       }
    }
-
-   public static <T> AnnotatedClass<T> of(Class<T> clazz)
-   {
-      return new AnnotatedClassImpl<T>(clazz);
-   }
    
    /**
-    * Constructor
-    * 
-    * Calls another constructor with the class annotations array
-    * 
-    * @param clazz The implementing class
-    */
-   public AnnotatedClassImpl(Class<T> clazz)
-   {
-      this(clazz, clazz, clazz.getAnnotations());
-   }
-
-   /**
     * Gets the implementing class
     * 
     * @return The class
@@ -372,7 +365,7 @@
    {
       return clazz;
    }
-
+   
    /**
     * Gets the delegate (class)
     * 
@@ -382,7 +375,7 @@
    {
       return clazz;
    }
-
+   
    /**
     * Gets the abstracted fields of the class
     * 
@@ -394,7 +387,7 @@
    {
       return Collections.unmodifiableSet(fields);
    }
-
+   
    /**
     * Gets the abstracted constructors of the class
     * 
@@ -406,7 +399,7 @@
    {
       return Collections.unmodifiableSet(constructors);
    }
-
+   
    /**
     * Gets abstracted fields with requested meta-annotation type present
     * 
@@ -415,7 +408,8 @@
     * populated for the requested meta-annotation type and the result is
     * returned
     * 
-    * @param metaAnnotationType The meta-annotation type to match
+    * @param metaAnnotationType
+    *           The meta-annotation type to match
     * @return The set of abstracted fields with meta-annotation present. Returns
     *         an empty set if no matches are found.
     */
@@ -423,13 +417,14 @@
    {
       return Collections.unmodifiableSet(metaAnnotatedFields.get(metaAnnotationType));
    }
-
+   
    /**
     * Gets the abstracted field annotated with a specific annotation type
     * 
     * If the fields map is null, initialize it first
     * 
-    * @param annotationType The annotation type to match
+    * @param annotationType
+    *           The annotation type to match
     * @return A set of matching abstracted fields, null if none are found.
     * 
     */
@@ -437,7 +432,7 @@
    {
       return Collections.unmodifiableSet(annotatedFields.get(annotationType));
    }
-
+   
    /**
     * Gets the type of the class
     * 
@@ -447,7 +442,7 @@
    {
       return clazz;
    }
-
+   
    /**
     * Gets the actual type arguments
     * 
@@ -459,13 +454,14 @@
    {
       return actualTypeArguments;
    }
-
+   
    /**
     * Gets the abstracted methods that have a certain annotation type present
     * 
     * If the annotated methods map is null, initialize it first
     * 
-    * @param annotationType The annotation type to match
+    * @param annotationType
+    *           The annotation type to match
     * @return A set of matching method abstractions. Returns an empty set if no
     *         matches are found.
     * 
@@ -475,11 +471,12 @@
    {
       return Collections.unmodifiableSet(annotatedMethods.get(annotationType));
    }
-
+   
    /**
     * Gets constructors with given annotation type
     * 
-    * @param annotationType The annotation type to match
+    * @param annotationType
+    *           The annotation type to match
     * @return A set of abstracted constructors with given annotation type. If
     *         the constructors set is empty, initialize it first. Returns an
     *         empty set if there are no matches.
@@ -490,11 +487,12 @@
    {
       return Collections.unmodifiableSet(annotatedConstructors.get(annotationType));
    }
-
+   
    /**
     * Gets a constructor with given arguments
     * 
-    * @param arguments The arguments to match
+    * @param arguments
+    *           The arguments to match
     * @return A constructor which takes given arguments. Null is returned if
     *         there are no matches.
     * 
@@ -522,7 +520,7 @@
       }
       return null;
    }
-
+   
    /**
     * Gets a string representation of the class
     * 
@@ -538,5 +536,5 @@
       toString = "Annotated class " + Names.class2String(getDelegate());
       return toString;
    }
-
+   
 }
\ No newline at end of file

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -67,7 +67,7 @@
       //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
       // TODO This should test a real class
       tuna = SimpleBean.of(Tuna.class, manager);
-      om = new AnnotatedMethodImpl<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }), new AnnotatedClassImpl<AnObserver>(AnObserver.class));
+      om = new AnnotatedMethodImpl<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }), AnnotatedClassImpl.of(AnObserver.class));
 
       AnObserver observerInstance = new AnObserver();
       // TODO Fix this Observer<Event> observer = new MockObserverImpl<Event>(tuna, om, Event.class);

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -18,7 +18,7 @@
    @Test
    public void testDeclaredAnnotations()
    {
-      AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
+      AnnotatedClass<Order> annotatedElement = AnnotatedClassImpl.of(Order.class);
       assert annotatedElement.getAnnotations().size() == 1;
       assert annotatedElement.getAnnotation(Production.class) != null;
       assert annotatedElement.getType().equals(Order.class);
@@ -27,7 +27,7 @@
    @Test
    public void testMetaAnnotations()
    {
-      AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
+      AnnotatedClass<Order> annotatedElement = AnnotatedClassImpl.of(Order.class);
       Set<Annotation> annotations = annotatedElement.getMetaAnnotations(DeploymentType.class);
       assert annotations.size() == 1;
       Iterator<Annotation> it = annotations.iterator();
@@ -38,10 +38,10 @@
    @Test
    public void testEmpty()
    {
-      AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
+      AnnotatedClass<Order> annotatedElement = AnnotatedClassImpl.of(Order.class);
       assert annotatedElement.getAnnotation(Stereotype.class) == null;
       assert annotatedElement.getMetaAnnotations(Stereotype.class).size() == 0;
-      AnnotatedClass<Antelope> classWithNoAnnotations = new AnnotatedClassImpl<Antelope>(Antelope.class);
+      AnnotatedClass<Antelope> classWithNoAnnotations = AnnotatedClassImpl.of(Antelope.class);
       assert classWithNoAnnotations.getAnnotations().size() == 0;
    }
    

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -16,7 +16,7 @@
 public class ResolutionByTypeTest extends AbstractTest
 {
    
-   private AnnotatedClass<FishFarm> fishFarmClass = new AnnotatedClassImpl<FishFarm>(FishFarm.class);
+   private AnnotatedClass<FishFarm> fishFarmClass = AnnotatedClassImpl.of(FishFarm.class);
 
    @Test(groups="resolution")
    public void testAnnotatedField() throws Exception

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java	2009-01-19 15:45:09 UTC (rev 1082)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/definition/scope/ScopeTypeTest.java	2009-01-19 15:58:59 UTC (rev 1083)
@@ -153,7 +153,7 @@
    @Test @SpecAssertion(section="4.1")
    public void testScopeTypeDeclaredInheritedIsBlockedByIntermediateClass()
    {
-      //assert getSimpleBean(GoldenRetriever.class).getScopeType().equals(ApplicationScoped.class);
+      assert createSimpleBean(GoldenRetriever.class).getScopeType().equals(ApplicationScoped.class);
    }
    
 }
\ No newline at end of file




More information about the weld-commits mailing list