[weld-commits] Weld SVN: r5647 - in core/trunk: impl/src/main/java/org/jboss/weld/introspector/jlr and 4 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Wed Jan 27 19:22:08 EST 2010


Author: pete.muir at jboss.org
Date: 2010-01-27 19:22:07 -0500 (Wed, 27 Jan 2010)
New Revision: 5647

Added:
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java
Modified:
   core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldException.java
   core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldClassImpl.java
   core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
   core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java
   core/trunk/impl/src/main/resources/org/jboss/weld/messages/util_en.properties
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java
Log:
WELD-372, still needs work on verifying parameters

Modified: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldException.java	2010-01-27 20:25:08 UTC (rev 5646)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldException.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -80,14 +80,16 @@
    {
       super();
       StringBuilder errorMessage = new StringBuilder();
-      boolean firstError = true;
+      int i = 0;;
       for (Throwable throwable : errors)
       {
-         if (!firstError)
+         if (i > 0)
          {
             errorMessage.append('\n');
          }
+         errorMessage.append("Exception #").append(i).append(" :");
          errorMessage.append(throwable.getLocalizedMessage());
+         i++;
       }
       this.message = new WeldExceptionMessage(errorMessage.toString());
    }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldClassImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldClassImpl.java	2010-01-27 20:25:08 UTC (rev 5646)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldClassImpl.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -23,6 +23,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -35,6 +36,7 @@
 import javax.enterprise.inject.spi.AnnotatedConstructor;
 import javax.enterprise.inject.spi.AnnotatedField;
 import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
 import javax.enterprise.inject.spi.AnnotatedType;
 
 import org.jboss.weld.bootstrap.events.ExternalAnnotatedType;
@@ -66,7 +68,19 @@
  */
 public class WeldClassImpl<T> extends AbstractWeldAnnotated<T, Class<T>> implements WeldClass<T>
 {
-   
+
+   private static <T> void mapConstructorAnnotations(SetMultimap<Class<? extends Annotation>, WeldConstructor<T>> annotatedConstructors, WeldConstructor<T> annotatedConstructor)
+   {
+      for (Annotation annotation : annotatedConstructor.getAnnotations())
+      {
+         if (!annotatedConstructors.containsKey(annotation.annotationType()))
+         {
+            annotatedConstructors.putAll(annotation.annotationType(), new HashSet<WeldConstructor<T>>());
+         }
+         annotatedConstructors.get(annotation.annotationType()).add(annotatedConstructor);
+      }
+   }
+
    // Class attributes
    private final WeldClass<?> superclass;
 
@@ -104,7 +118,7 @@
    private final SetMultimap<Class<? extends Annotation>, WeldConstructor<T>> annotatedConstructors;
    // The map from class list to abstracted constructor
    private final Map<List<Class<?>>, WeldConstructor<T>> constructorsByArgumentMap;
-   
+
    // The meta-annotation map (annotation type -> set of annotations containing
    // meta-annotation) of the item
    private final SetMultimap<Class<? extends Annotation>, Annotation> declaredMetaAnnotationMap;
@@ -156,51 +170,60 @@
       this.declaredAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WeldField<?, T>>>(), HashSetSupplier.<WeldField<?, T>> instance());
       this.declaredMetaAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WeldField<?, ?>>>(), HashSetSupplier.<WeldField<?, ?>> instance());
 
-      Map<Field, AnnotatedField<? super T>> annotatedTypeFields = new HashMap<Field, AnnotatedField<? super T>>();
-      if (annotatedType != null)
+      if (annotatedType == null)
       {
-         for (AnnotatedField<? super T> annotatedField : annotatedType.getFields())
+         for (Class<?> c = rawType; c != Object.class && c != null; c = c.getSuperclass())
          {
-            annotatedTypeFields.put(annotatedField.getJavaMember(), annotatedField);
+            for (Field field : SecureReflections.getDeclaredFields(c))
+            {
+               WeldField<?, T> annotatedField = WeldFieldImpl.of(field, this.<T> getDeclaringWeldClass(field, classTransformer), classTransformer);
+               this.fields.add(annotatedField);
+               if (c == rawType)
+               {
+                  this.declaredFields.add(annotatedField);
+                  this.declaredFieldsByName.put(annotatedField.getName(), annotatedField);
+               }
+               for (Annotation annotation : annotatedField.getAnnotations())
+               {
+                  this.annotatedFields.put(annotation.annotationType(), annotatedField);
+                  if (c == rawType)
+                  {
+                     this.declaredAnnotatedFields.put(annotation.annotationType(), annotatedField);
+                  }
+                  for (Annotation metaAnnotation : annotation.annotationType().getAnnotations())
+                  {
+                     if (c == rawType)
+                     {
+                        this.declaredMetaAnnotatedFields.put(metaAnnotation.annotationType(), annotatedField);
+                     }
+                  }
+               }
+            }
          }
       }
-
-      for (Class<?> c = rawType; c != Object.class && c != null; c = c.getSuperclass())
+      else
       {
-         for (Field field : SecureReflections.getDeclaredFields(c))
+         for (AnnotatedField<? super T> field : annotatedType.getFields())
          {
-            WeldField<?, T> annotatedField = null;
-            if (annotatedTypeFields.containsKey(field))
+            WeldField<?, T> weldField = WeldFieldImpl.of(field, this.<T> getDeclaringWeldClass(field.getJavaMember(), classTransformer), classTransformer);
+            this.fields.add(weldField);
+            if (field.getDeclaringType().getJavaClass() == rawType)
             {
-               annotatedField = WeldFieldImpl.of(annotatedTypeFields.get(field), this.<T> getDeclaringWBClass(field, classTransformer), classTransformer);
+               this.declaredFields.add(weldField);
+               this.declaredFieldsByName.put(weldField.getName(), weldField);
             }
-            else
+            for (Annotation annotation : weldField.getAnnotations())
             {
-               annotatedField = WeldFieldImpl.of(field, this.<T> getDeclaringWBClass(field, classTransformer), classTransformer);
-            }
-
-            this.fields.add(annotatedField);
-            if (c == rawType)
-            {
-               this.declaredFields.add(annotatedField);
-               this.declaredFieldsByName.put(annotatedField.getName(), annotatedField);
-            }
-            for (Annotation annotation : annotatedField.getAnnotations())
-            {
-               this.annotatedFields.put(annotation.annotationType(), annotatedField);
-               if (c == rawType)
+               this.annotatedFields.put(annotation.annotationType(), weldField);
+               if (field.getDeclaringType().getJavaClass() == rawType)
                {
-                  this.declaredAnnotatedFields.put(annotation.annotationType(), annotatedField);
-               }
-               for (Annotation metaAnnotation : annotation.annotationType().getAnnotations())
-               {
-                  if (c == rawType)
+                  this.declaredAnnotatedFields.put(annotation.annotationType(), weldField);
+                  for (Annotation metaAnnotation : annotation.annotationType().getAnnotations())
                   {
-                     this.declaredMetaAnnotatedFields.put(metaAnnotation.annotationType(), annotatedField);
+                     this.declaredMetaAnnotatedFields.put(metaAnnotation.annotationType(), weldField);
                   }
                }
             }
-
          }
       }
 
@@ -209,43 +232,38 @@
       this.constructorsByArgumentMap = new HashMap<List<Class<?>>, WeldConstructor<T>>();
       this.annotatedConstructors = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WeldConstructor<T>>>(), HashSetSupplier.<WeldConstructor<T>> instance());
 
-      Map<Constructor<? super T>, AnnotatedConstructor<T>> annotatedTypeConstructors = new HashMap<Constructor<? super T>, AnnotatedConstructor<T>>();
-      if (annotatedType != null)
+      this.declaredConstructorsBySignature = new HashMap<ConstructorSignature, WeldConstructor<?>>();
+      if (annotatedType == null)
       {
-         for (AnnotatedConstructor<T> annotated : annotatedType.getConstructors())
+         for (Constructor<?> constructor : SecureReflections.getDeclaredConstructors(rawType))
          {
-            annotatedTypeConstructors.put(annotated.getJavaMember(), annotated);
+            @SuppressWarnings("unchecked")
+            Constructor<T> c = (Constructor<T>) constructor;
+
+            WeldConstructor<T> annotatedConstructor = WeldConstructorImpl.of(c, this.<T> getDeclaringWeldClass(c, classTransformer), classTransformer);
+            this.constructors.add(annotatedConstructor);
+            this.constructorsByArgumentMap.put(Arrays.asList(constructor.getParameterTypes()), annotatedConstructor);
+            this.declaredConstructorsBySignature.put(annotatedConstructor.getSignature(), annotatedConstructor);
+            mapConstructorAnnotations(annotatedConstructors, annotatedConstructor);
          }
       }
-
-      this.declaredConstructorsBySignature = new HashMap<ConstructorSignature, WeldConstructor<?>>();
-      for (Constructor<?> constructor : SecureReflections.getDeclaredConstructors(rawType))
+      else
       {
-         WeldConstructor<T> annotatedConstructor = null;
-         if (annotatedTypeConstructors.containsKey(constructor))
+         for (AnnotatedConstructor<T> constructor : annotatedType.getConstructors())
          {
-            WeldClass<T> declaringClass = this.getDeclaringWBClass(constructor, classTransformer);
-            annotatedConstructor = WeldConstructorImpl.of(annotatedTypeConstructors.get(constructor), declaringClass, classTransformer);
-         }
-         else
-         {
-            // TODO Fix this cast
-            Constructor<T> c = (Constructor<T>) constructor;
-            annotatedConstructor = WeldConstructorImpl.of(c, this.<T> getDeclaringWBClass(c, classTransformer), classTransformer);
-         }
+            WeldClass<T> declaringClass = this.getDeclaringWeldClass(constructor.getJavaMember(), classTransformer);
+            WeldConstructor<T> weldConstructor = WeldConstructorImpl.of(constructor, declaringClass, classTransformer);
 
-         this.constructors.add(annotatedConstructor);
-         this.constructorsByArgumentMap.put(Arrays.asList(constructor.getParameterTypes()), annotatedConstructor);
+            this.constructors.add(weldConstructor);
 
-         this.declaredConstructorsBySignature.put(annotatedConstructor.getSignature(), annotatedConstructor);
-
-         for (Annotation annotation : annotatedConstructor.getAnnotations())
-         {
-            if (!annotatedConstructors.containsKey(annotation.annotationType()))
+            List<Class<?>> parameterTypes = new ArrayList<Class<?>>();
+            for (AnnotatedParameter<T> parameter : constructor.getParameters())
             {
-               annotatedConstructors.putAll(annotation.annotationType(), new HashSet<WeldConstructor<T>>());
+               parameterTypes.add(Reflections.getRawType(parameter.getBaseType()));
             }
-            annotatedConstructors.get(annotation.annotationType()).add(annotatedConstructor);
+            this.constructorsByArgumentMap.put(parameterTypes, weldConstructor);
+            this.declaredConstructorsBySignature.put(weldConstructor.getSignature(), weldConstructor);
+            mapConstructorAnnotations(annotatedConstructors, weldConstructor);
          }
       }
 
@@ -258,57 +276,75 @@
       this.declaredMethodsBySignature = new HashMap<MethodSignature, WeldMethod<?, ?>>();
       this.methodsBySignature = new HashMap<MethodSignature, WeldMethod<?, ?>>();
 
-      Map<Method, AnnotatedMethod<?>> annotatedTypeMethods = new HashMap<Method, AnnotatedMethod<?>>();
-      if (annotatedType != null)
+      if (annotatedType == null)
       {
-         for (AnnotatedMethod<?> annotated : annotatedType.getMethods())
+         for (Class<?> c = rawType; c != Object.class && c != null; c = c.getSuperclass())
          {
-            annotatedTypeMethods.put(annotated.getJavaMember(), annotated);
+            for (Method method : SecureReflections.getDeclaredMethods(c))
+            {
+               WeldMethod<?, T> weldMethod  = WeldMethodImpl.of(method, this.<T> getDeclaringWeldClass(method, classTransformer), classTransformer);
+               this.methods.add(weldMethod);
+               this.methodsBySignature.put(weldMethod.getSignature(), weldMethod);
+               if (c == rawType)
+               {
+                  this.declaredMethods.add(weldMethod);
+                  this.declaredMethodsBySignature.put(weldMethod.getSignature(), weldMethod);
+               }
+               for (Annotation annotation : weldMethod.getAnnotations())
+               {
+                  annotatedMethods.put(annotation.annotationType(), weldMethod);
+                  if (c == rawType)
+                  {
+                     this.declaredAnnotatedMethods.put(annotation.annotationType(), weldMethod);
+                  }
+               }
+               for (Class<? extends Annotation> annotationType : WeldMethod.MAPPED_PARAMETER_ANNOTATIONS)
+               {
+                  if (weldMethod.getWeldParameters(annotationType).size() > 0)
+                  {
+                     if (c == rawType)
+                     {
+                        this.declaredMethodsByAnnotatedParameters.put(annotationType, weldMethod);
+                     }
+                  }
+               }
+            }
          }
       }
-
-      for (Class<?> c = rawType; c != Object.class && c != null; c = c.getSuperclass())
+      else
       {
-         for (Method method : SecureReflections.getDeclaredMethods(c))
+         for (AnnotatedMethod<? super T> method : annotatedType.getMethods())
          {
-            WeldMethod<?, T> annotatedMethod = null;
-            if (annotatedTypeMethods.containsKey(method))
+            WeldMethod<?, T> weldMethod = WeldMethodImpl.of(method, this, classTransformer);
+            this.methods.add(weldMethod);
+            this.methodsBySignature.put(weldMethod.getSignature(), weldMethod);
+            if (method.getDeclaringType().getJavaClass() == rawType)
             {
-               annotatedMethod = WeldMethodImpl.of(annotatedTypeMethods.get(method), this, classTransformer);
+               this.declaredMethods.add(weldMethod);
+               this.declaredMethodsBySignature.put(weldMethod.getSignature(), weldMethod);
             }
-            else
+            for (Annotation annotation : weldMethod.getAnnotations())
             {
-               annotatedMethod = WeldMethodImpl.of(method, this.<T> getDeclaringWBClass(method, classTransformer), classTransformer);
-            }
-            this.methods.add(annotatedMethod);
-            this.methodsBySignature.put(annotatedMethod.getSignature(), annotatedMethod);
-            if (c == rawType)
-            {
-               this.declaredMethods.add(annotatedMethod);
-               this.declaredMethodsBySignature.put(annotatedMethod.getSignature(), annotatedMethod);
-            }
-            for (Annotation annotation : annotatedMethod.getAnnotations())
-            {
-               annotatedMethods.put(annotation.annotationType(), annotatedMethod);
-               if (c == rawType)
+               annotatedMethods.put(annotation.annotationType(), weldMethod);
+               if (method.getDeclaringType().getJavaClass() == rawType)
                {
-                  this.declaredAnnotatedMethods.put(annotation.annotationType(), annotatedMethod);
+                  this.declaredAnnotatedMethods.put(annotation.annotationType(), weldMethod);
                }
             }
             for (Class<? extends Annotation> annotationType : WeldMethod.MAPPED_PARAMETER_ANNOTATIONS)
             {
-               if (annotatedMethod.getWeldParameters(annotationType).size() > 0)
+               if (weldMethod.getWeldParameters(annotationType).size() > 0)
                {
-                  if (c == rawType)
+                  if (method.getDeclaringType().getJavaClass() == rawType)
                   {
-                     this.declaredMethodsByAnnotatedParameters.put(annotationType, annotatedMethod);
+                     this.declaredMethodsByAnnotatedParameters.put(annotationType, weldMethod);
                   }
                }
             }
          }
       }
-      
-      this.declaredMetaAnnotationMap = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<Annotation>>(), HashSetSupplier.<Annotation>instance());
+
+      this.declaredMetaAnnotationMap = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<Annotation>>(), HashSetSupplier.<Annotation> instance());
       for (Annotation declaredAnnotation : declaredAnnotationMap.values())
       {
          addMetaAnnotations(declaredMetaAnnotationMap, declaredAnnotation, declaredAnnotation.annotationType().getAnnotations(), true);
@@ -318,7 +354,7 @@
    }
 
    @SuppressWarnings("unchecked")
-   private <X> WeldClass<X> getDeclaringWBClass(Member member, ClassTransformer transformer)
+   private <X> WeldClass<X> getDeclaringWeldClass(Member member, ClassTransformer transformer)
    {
       if (member.getDeclaringClass().equals(getJavaClass()))
       {
@@ -636,7 +672,7 @@
    {
       return (Set) methods;
    }
-   
+
    public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
    {
       return Collections.unmodifiableSet(declaredMetaAnnotationMap.get(metaAnnotationType));

Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java	2010-01-27 20:25:08 UTC (rev 5646)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -672,7 +672,7 @@
       {
          if (initializerAnnotatedConstructors.size() > 1)
          {
-            throw new DefinitionException(AMBIGUOUS_CONSTRUCTOR, type);
+            throw new DefinitionException(AMBIGUOUS_CONSTRUCTOR, type, initializerAnnotatedConstructors);
          }
       }
       else if (initializerAnnotatedConstructors.size() == 1)

Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java	2010-01-27 20:25:08 UTC (rev 5646)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -635,5 +635,22 @@
    {
       return clazz.isPrimitive() || Serializable.class.isAssignableFrom(clazz);
    }
+   
+   @SuppressWarnings("unchecked")
+   public static <T> Class<T> getRawType(Type type)
+   {
+      if (type instanceof Class<?>)
+      {
+         return (Class<T>) type;
+      }
+      else if (type instanceof ParameterizedType)
+      {
+         if (((ParameterizedType) type).getRawType() instanceof Class<?>)
+         {
+            return (Class<T>) ((ParameterizedType) type).getRawType();
+         }
+      }
+      return null;
+   }
 
 }

Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/util_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/util_en.properties	2010-01-27 20:25:08 UTC (rev 5646)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/util_en.properties	2010-01-28 00:22:07 UTC (rev 5647)
@@ -10,8 +10,8 @@
 INITIALIZER_CANNOT_BE_OBSERVER=Initializer method {0} cannot be annotated @Observes on {1}
 QUALIFIER_ON_FINAL_FIELD=Cannot place qualifiers on final fields:  {0}
 TOO_MANY_INITIALIZERS=Cannot have more than one constructor annotated with @Initializer for {0}
-AMBIGUOUS_CONSTRUCTOR=Cannot determine constructor to use for {0}
-INVALID_QUANTITY_INJECTABLE_FIELDS_AND_INITIALIZER_METHODS=injectableFields and initializerMethods must have the same size.\\n\\nInjectable Fields:  {0}\\nInitializerMethods:  {1}
+AMBIGUOUS_CONSTRUCTOR=Cannot determine constructor to use for {0}. Possible constructors {1}
+INVALID_QUANTITY_INJECTABLE_FIELDS_AND_INITIALIZER_METHODS=injectableFields and initializerMethods must have the same size.\\n\\nInjectable Fields\:  {0}\\nInitializerMethods\:  {1}
 ANNOTATION_NOT_QUALIFIER=Annotation {0} is not a qualifier
 REDUNDANT_QUALIFIER=Qualifier {0} is already present in the set {1}
 UNABLE_TO_FIND_CONSTRUCTOR=Cannot determine constructor to use for {0}

Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java	2010-01-27 20:25:08 UTC (rev 5646)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -17,36 +17,435 @@
 package org.jboss.weld.tests.extensions.annotatedType;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.lang.reflect.Type;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AnnotatedCallable;
 import javax.enterprise.inject.spi.AnnotatedConstructor;
 import javax.enterprise.inject.spi.AnnotatedField;
 import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.BeforeBeanDiscovery;
 import javax.enterprise.inject.spi.Extension;
+import javax.inject.Inject;
 
 import org.jboss.weld.tests.extensions.annotatedType.EcoFriendlyWashingMachine.EcoFriendlyWashingMachineLiteral;
+import org.jboss.weld.util.collections.Arrays2;
 
 public class AnnotatedTypeExtension implements Extension
 {
    
+   public void addTumbleDryer(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
+   {
+      
+      final Set<AnnotatedConstructor<TumbleDryer>> constructors = new HashSet<AnnotatedConstructor<TumbleDryer>>();
+      final Set<AnnotatedField<? super TumbleDryer>> fields = new HashSet<AnnotatedField<? super TumbleDryer>>();
+      final Set<AnnotatedMethod<? super TumbleDryer>> methods = new HashSet<AnnotatedMethod<? super TumbleDryer>>();
+      
+      final AnnotatedType<TumbleDryer> tumbleDryer = new AnnotatedType<TumbleDryer>()
+      {
+
+         public Set<AnnotatedConstructor<TumbleDryer>> getConstructors()
+         {
+            return constructors;
+         }
+
+         public Set<AnnotatedField<? super TumbleDryer>> getFields()
+         {
+            return fields;
+         }
+         
+         public Set<AnnotatedMethod<? super TumbleDryer>> getMethods()
+         {
+            return methods;
+         }
+         
+         // Now the easy stuff
+
+         public Class<TumbleDryer> getJavaClass()
+         {
+            return TumbleDryer.class;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            // Class has no annotations
+            return null;
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.emptySet();
+         }
+
+         public Type getBaseType()
+         {
+            return TumbleDryer.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            // Class has no annotations
+            return false;
+         }
+         
+      };
+      
+      AnnotatedField<TumbleDryer> plug = new AnnotatedField<TumbleDryer>()
+      {
+
+         public Field getJavaMember()
+         {
+            try
+            {
+               return TumbleDryer.class.getDeclaredField("plug");
+            }
+            catch (NoSuchFieldException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+
+         public boolean isStatic()
+         {
+            return false;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return annotationType.cast(InjectLiteral.INSTANCE);
+            }
+            else if (annotationType.equals(Special.class))
+            {
+               return annotationType.cast(SpecialLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Arrays2.asSet(InjectLiteral.INSTANCE, SpecialLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return Plug.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(Plug.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Inject.class) || annotationType.equals(Special.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+
+         public AnnotatedType<TumbleDryer> getDeclaringType()
+         {
+            return tumbleDryer;
+         }
+      };
+      fields.add(plug);
+      
+      
+      final List<AnnotatedParameter<TumbleDryer>> runningTimeParameters = new ArrayList<AnnotatedParameter<TumbleDryer>>();
+      final AnnotatedMethod<TumbleDryer> runningTimeMethod = new AnnotatedMethod<TumbleDryer>()
+      {
+
+         public Method getJavaMember()
+         {
+            try
+            {
+               return TumbleDryer.class.getDeclaredMethod("setRunningTime", RunningTime.class);
+            }
+            catch (NoSuchMethodException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+
+         public List<AnnotatedParameter<TumbleDryer>> getParameters()
+         {
+            return runningTimeParameters;
+         }
+
+         public AnnotatedType<TumbleDryer> getDeclaringType()
+         {
+            return tumbleDryer;
+         }
+
+         public boolean isStatic()
+         {
+            return false;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return annotationType.cast(InjectLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.<Annotation>singleton(InjectLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return TumbleDryer.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+         
+      };
+      methods.add(runningTimeMethod);
+      
+      final AnnotatedParameter<TumbleDryer> runningTimeParameter = new AnnotatedParameter<TumbleDryer>()
+      {
+
+         public AnnotatedCallable<TumbleDryer> getDeclaringCallable()
+         {
+            return runningTimeMethod;
+         }
+
+         public int getPosition()
+         {
+            return 0;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Special.class))
+            {
+               return annotationType.cast(SpecialLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.<Annotation>singleton(SpecialLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return RunningTime.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Collections.<Type>singleton(RunningTime.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Special.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+      };
+      runningTimeParameters.add(runningTimeParameter);
+      
+      final List<AnnotatedParameter<TumbleDryer>> clothesParameters = new ArrayList<AnnotatedParameter<TumbleDryer>>();
+      final AnnotatedConstructor<TumbleDryer> clothesConstructor = new AnnotatedConstructor<TumbleDryer>()
+      {
+
+         public Constructor<TumbleDryer> getJavaMember()
+         {
+            try
+            {
+               return TumbleDryer.class.getDeclaredConstructor(Clothes.class);
+            }
+            catch (NoSuchMethodException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+
+         public List<AnnotatedParameter<TumbleDryer>> getParameters()
+         {
+            return clothesParameters;
+         }
+
+         public AnnotatedType<TumbleDryer> getDeclaringType()
+         {
+            return tumbleDryer;
+         }
+
+         public boolean isStatic()
+         {
+            return false;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return annotationType.cast(InjectLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.<Annotation>singleton(InjectLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return TumbleDryer.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+      };
+      constructors.add(clothesConstructor);
+      
+      AnnotatedParameter<TumbleDryer> clothesParameter = new AnnotatedParameter<TumbleDryer>()
+      {
+
+         public AnnotatedCallable<TumbleDryer> getDeclaringCallable()
+         {
+            return clothesConstructor;
+         }
+
+         public int getPosition()
+         {
+            return 0;
+         }
+
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Special.class))
+            {
+               return annotationType.cast(SpecialLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.<Annotation>singleton(SpecialLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return Clothes.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(Clothes.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Special.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+      };
+      clothesParameters.add(clothesParameter);
+      
+      beforeBeanDiscovery.addAnnotatedType(tumbleDryer);
+   }
+   
    /**
     * Adds an eco friendly wasing machine
     * @param beforeBeanDiscovery
     */
    public void addWashingMachine(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
    {
-      beforeBeanDiscovery.addAnnotatedType(new AnnotatedType<WashingMachine>()
+      final Set<AnnotatedConstructor<WashingMachine>> constructors = new HashSet<AnnotatedConstructor<WashingMachine>>();
+      final AnnotatedType<WashingMachine> type = new AnnotatedType<WashingMachine>()
       {
 
          public Set<AnnotatedConstructor<WashingMachine>> getConstructors()
          {
-            return Collections.emptySet();
+            return constructors;
          }
 
          public Set<AnnotatedField<? super WashingMachine>> getFields()
@@ -85,10 +484,7 @@
 
          public Set<Type> getTypeClosure()
          {
-            Set<Type> ret = new HashSet<Type>();
-            ret.add(Object.class);
-            ret.add(WashingMachine.class);
-            return ret;
+            return Arrays2.<Type>asSet(WashingMachine.class, Object.class);
          }
 
          public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
@@ -96,6 +492,65 @@
             return annotationType == EcoFriendlyWashingMachine.class;
          }
          
-      });
+      };
+      
+      final AnnotatedConstructor<WashingMachine> constructor = new AnnotatedConstructor<WashingMachine>()
+      {
+
+         public Constructor<WashingMachine> getJavaMember()
+         {
+            try
+            {
+               return WashingMachine.class.getDeclaredConstructor();
+            }
+            catch (NoSuchMethodException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+
+         public List<AnnotatedParameter<WashingMachine>> getParameters()
+         {
+            return Collections.emptyList();
+         }
+
+         public AnnotatedType<WashingMachine> getDeclaringType()
+         {
+            return type;
+         }
+
+         public boolean isStatic()
+         {
+            return false;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            return null;
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.emptySet();
+         }
+
+         public Type getBaseType()
+         {
+            return WashingMachine.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(WashingMachine.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            return false;
+         }
+      };
+      constructors.add(constructor);
+      
+      beforeBeanDiscovery.addAnnotatedType(type);
    }
 }

Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java	2010-01-27 20:25:08 UTC (rev 5646)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -16,13 +16,21 @@
  */
 package org.jboss.weld.tests.extensions.annotatedType;
 
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Set;
+
 import javax.enterprise.inject.Any;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.jboss.testharness.impl.packaging.Artifact;
 import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
 import org.jboss.testharness.impl.packaging.jsr299.Extension;
 import org.jboss.weld.test.AbstractWeldTest;
 import org.jboss.weld.test.Utils;
@@ -31,7 +39,6 @@
 
 @Artifact
 @IntegrationTest
- at Packaging(PackagingType.EAR)
 @Extension("javax.enterprise.inject.spi.Extension")
 public class AnnotatedTypeExtensionTest extends AbstractWeldTest
 {
@@ -49,7 +56,102 @@
    {
       Bean<WashingMachine> bean = getBean(WashingMachine.class, EcoFriendlyWashingMachineLiteral.INSTANCE);
       assert Utils.annotationSetMatches(bean.getQualifiers(), Any.class, EcoFriendlyWashingMachine.class);
+      
+      // Verify overriding the class structure works
+      Clothes.reset();
+      TumbleDryer tumbleDryer = getReference(TumbleDryer.class);
+      Bean<TumbleDryer> tumbleDryerBean = getBean(TumbleDryer.class);
+      assert tumbleDryer != null;
+      
+      assert !containsConstructor(tumbleDryerBean.getInjectionPoints(), SerialNumber.class);
+      assert containsConstructor(tumbleDryerBean.getInjectionPoints(), Clothes.class);
+      assert tumbleDryer.getSerialNumber() == null;
+      assert tumbleDryer.getClothes() != null;
+      assert !Clothes.getInjectionPoint().getAnnotated().isAnnotationPresent(Original.class);
+      AnnotatedConstructor<?> clothesConstructor = getConstructor(tumbleDryerBean.getInjectionPoints(), Clothes.class); 
+      assert clothesConstructor.getParameters().get(0).isAnnotationPresent(Special.class);
+      assert !clothesConstructor.getParameters().get(0).isAnnotationPresent(Original.class);
+     
+      assert containsField(tumbleDryerBean.getInjectionPoints(), "plug");
+      assert !containsField(tumbleDryerBean.getInjectionPoints(), "coins");
+      assert tumbleDryer.getPlug() != null;
+      assert tumbleDryer.getCoins() == null;
+      
+      assert containsMethod(tumbleDryerBean.getInjectionPoints(), "setRunningTime", RunningTime.class);
+      assert !containsMethod(tumbleDryerBean.getInjectionPoints(), "setHotAir", HotAir.class);
+      assert tumbleDryer.getRunningTime() != null;
+      assert tumbleDryer.getHotAir() == null;
+      AnnotatedMethod<?> runningTimeMethod = getMethod(tumbleDryerBean.getInjectionPoints(), "setRunningTime", RunningTime.class);
+      assert runningTimeMethod.getParameters().get(0).isAnnotationPresent(Special.class);
+      assert !runningTimeMethod.getParameters().get(0).isAnnotationPresent(Original.class);
    }
    
+   private static boolean containsField(Set<InjectionPoint> injectionPoints, String name)
+   {
+      for (InjectionPoint ip : injectionPoints)
+      {
+         if (ip.getAnnotated() instanceof AnnotatedField<?>)
+         {
+            AnnotatedField<?> field = (AnnotatedField<?>) ip.getAnnotated();
+            if (field.getJavaMember().getName().equals(name))
+            {
+               return true;
+            }
+         }
+      }
+      return false;
+   }
+   
+   private static boolean containsConstructor(Set<InjectionPoint> injectionPoints, Class<?>... parameters)
+   {
+      return getConstructor(injectionPoints, parameters) != null;
+   }
+   
+   private static AnnotatedConstructor<?> getConstructor(Set<InjectionPoint> injectionPoints, Class<?>... parameters)
+   {
+      for (InjectionPoint ip : injectionPoints)
+      {
+         if (ip.getAnnotated() instanceof AnnotatedParameter<?>)
+         {
+            AnnotatedParameter<?> param = (AnnotatedParameter<?>) ip.getAnnotated();
+            if (param.getDeclaringCallable() instanceof AnnotatedConstructor<?>)
+            {
+               Class<?>[] parameterTypes = ((Constructor<?>) param.getDeclaringCallable().getJavaMember()).getParameterTypes();
+               if (Arrays.equals(parameters, parameterTypes))
+               {
+                  return (AnnotatedConstructor<?>) param.getDeclaringCallable();
+               }
+            }
+         }
+      }
+      return null;
+   }
+   
+   private static boolean containsMethod(Set<InjectionPoint> injectionPoints, String name, Class<?>... parameters)
+   {
+      return getMethod(injectionPoints, name, parameters) != null;
+   }
+   
+   private static AnnotatedMethod<?> getMethod(Set<InjectionPoint> injectionPoints, String name, Class<?>... parameters)
+   {
+      for (InjectionPoint ip : injectionPoints)
+      {
+         if (ip.getAnnotated() instanceof AnnotatedParameter<?>)
+         {
+            AnnotatedParameter<?> param = (AnnotatedParameter<?>) ip.getAnnotated();
+            if (param.getDeclaringCallable() instanceof AnnotatedMethod<?>)
+            {
+               Class<?>[] parameterTypes = ((Method) param.getDeclaringCallable().getJavaMember()).getParameterTypes();
+               String methodName = param.getDeclaringCallable().getJavaMember().getName();
+               if (Arrays.equals(parameters, parameterTypes) && methodName.equals(name))
+               {
+                  return (AnnotatedMethod<?>) param.getDeclaringCallable();
+               }
+            }
+         }
+      }
+      return null;
+   }
+   
 
 }

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,28 @@
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+ at Special
+public class Clothes
+{
+   
+   private static InjectionPoint injectionPoint;
+   
+   @Inject 
+   public void setInjectionPoint(InjectionPoint injectionPoint)
+   {
+      Clothes.injectionPoint = injectionPoint;
+   }
+   
+   public static void reset()
+   {
+      injectionPoint = null;
+   }
+   
+   public static InjectionPoint getInjectionPoint()
+   {
+      return injectionPoint;
+   }
+
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,6 @@
+package org.jboss.weld.tests.extensions.annotatedType;
+
+public class Coins
+{
+
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,6 @@
+package org.jboss.weld.tests.extensions.annotatedType;
+
+public class HotAir
+{
+
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+public class InjectLiteral extends AnnotationLiteral<Inject> implements Inject
+{
+   
+   public static final Inject INSTANCE = new InjectLiteral();
+   
+   private InjectLiteral() {}
+   
+}
\ No newline at end of file


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface Original
+{
+
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,7 @@
+package org.jboss.weld.tests.extensions.annotatedType;
+
+ at Special
+public class Plug
+{
+
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,7 @@
+package org.jboss.weld.tests.extensions.annotatedType;
+
+ at Special
+public class RunningTime
+{
+
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,6 @@
+package org.jboss.weld.tests.extensions.annotatedType;
+
+public class SerialNumber
+{
+
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface Special
+{
+
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+public class SpecialLiteral extends AnnotationLiteral<Special> implements Special
+{
+   
+   public static final Special INSTANCE = new SpecialLiteral();
+   
+   private SpecialLiteral() {}
+   
+}
\ No newline at end of file


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java	                        (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java	2010-01-28 00:22:07 UTC (rev 5647)
@@ -0,0 +1,77 @@
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import javax.inject.Inject;
+
+
+public class TumbleDryer
+{
+
+   
+   private Plug plug;
+   
+   @Inject @Original
+   private Coins coins;
+   
+   private final Clothes clothers;
+
+   private RunningTime runningTime;
+
+   private final SerialNumber serialNumber;
+
+   private HotAir hotAir;
+   
+   public TumbleDryer(@Original Clothes clothes)
+   {
+      this.clothers = clothes;
+      this.serialNumber = null;
+   }
+   
+   @Inject
+   public TumbleDryer(SerialNumber serialNumber)
+   {
+      this.serialNumber = serialNumber;
+      this.clothers = null;
+   }
+   
+   public void setRunningTime(@Original RunningTime runningTime)
+   {
+      this.runningTime = runningTime;  
+   }
+   
+   @Inject
+   public void setHotAir(HotAir hotAir)
+   {
+      this.hotAir = hotAir;
+   }
+   
+   public Plug getPlug()
+   {
+      return plug;
+   }
+   
+   public Clothes getClothes()
+   {
+      return clothers;
+   }
+   
+   public HotAir getHotAir()
+   {
+      return hotAir;
+   }
+   
+   public RunningTime getRunningTime()
+   {
+      return runningTime;
+   }
+   
+   public SerialNumber getSerialNumber()
+   {
+      return serialNumber;
+   }
+   
+   public Coins getCoins()
+   {
+      return coins;
+   }
+   
+}


Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the weld-commits mailing list