[weld-commits] Weld SVN: r6200 - in extensions/trunk: src/main/java/org/jboss/weld/extensions/bean/generic and 2 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Thu Apr 29 17:36:10 EDT 2010


Author: pete.muir at jboss.org
Date: 2010-04-29 17:36:09 -0400 (Thu, 29 Apr 2010)
New Revision: 6200

Added:
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedCallableImpl.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedConstructorImpl.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedFieldImpl.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedImpl.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedMemberImpl.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedMethodImpl.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedParameterImpl.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedTypeBuilder.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedTypeImpl.java
Removed:
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedCallable.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedElement.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedMember.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedConstructor.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedField.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedMethod.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedParameter.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedType.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedTypeBuilder.java
Modified:
   extensions/trunk/pom.xml
   extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/generic/GenericExtension.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/core/CoreExtension.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotationBuilder.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotationStore.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/TypeClosureBuilder.java
Log:
cleanup annotated

Modified: extensions/trunk/pom.xml
===================================================================
--- extensions/trunk/pom.xml	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/pom.xml	2010-04-29 21:36:09 UTC (rev 6200)
@@ -59,7 +59,7 @@
 
    <properties>
       <weld.api.version>1.0-SP1</weld.api.version>
-      <weld.core.version>1.0.1-Final</weld.core.version>
+      <weld.core.version>1.0.1-SNAPSHOT</weld.core.version>
       <slf4j.version>1.5.10</slf4j.version>
       <testng.version>5.12.1</testng.version>
       <jboss.test.harness.version>1.1.0-CR3</jboss.test.harness.version>

Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/generic/GenericExtension.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/generic/GenericExtension.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/generic/GenericExtension.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -45,7 +45,7 @@
 
 import org.jboss.weld.extensions.bean.CustomBeanBuilder;
 import org.jboss.weld.extensions.util.AnnotationInstanceProvider;
-import org.jboss.weld.extensions.util.annotated.NewAnnotatedTypeBuilder;
+import org.jboss.weld.extensions.util.annotated.AnnotatedTypeBuilder;
 
 public class GenericExtension implements Extension
 {
@@ -162,7 +162,7 @@
    {
       SyntheticQualifier newQualifier = getQualifierForGeneric(conc);
 
-      NewAnnotatedTypeBuilder<X> builder = NewAnnotatedTypeBuilder.newInstance(at).readAnnotationsFromUnderlying();
+      AnnotatedTypeBuilder<X> builder = AnnotatedTypeBuilder.newInstance(at).readAnnotationsFromUnderlyingType();
       builder.addToClass(newQualifier);
       for (AnnotatedField<? super X> f : at.getFields())
       {

Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/core/CoreExtension.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/core/CoreExtension.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/core/CoreExtension.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -42,7 +42,7 @@
 import org.jboss.weld.extensions.core.Exact.ExactLiteral;
 import org.jboss.weld.extensions.util.annotated.AnnotationBuilder;
 import org.jboss.weld.extensions.util.annotated.MemberAnnotationRedefiner;
-import org.jboss.weld.extensions.util.annotated.NewAnnotatedTypeBuilder;
+import org.jboss.weld.extensions.util.annotated.AnnotatedTypeBuilder;
 import org.jboss.weld.extensions.util.annotated.Parameter;
 import org.jboss.weld.extensions.util.annotated.ParameterAnnotationRedefiner;
 
@@ -74,7 +74,7 @@
          return;
       }
 
-      NewAnnotatedTypeBuilder<X> builder = NewAnnotatedTypeBuilder.newInstance(pat.getAnnotatedType()).readAnnotationsFromUnderlying();
+      AnnotatedTypeBuilder<X> builder = AnnotatedTypeBuilder.newInstance(pat.getAnnotatedType()).readAnnotationsFromUnderlyingType();
 
       // support for @Named packages
       Package pkg = pat.getAnnotatedType().getJavaClass().getPackage();
@@ -157,7 +157,7 @@
       {
          if (constructor.isAnnotationPresent(Constructs.class))
          {
-            NewAnnotatedTypeBuilder<X> annotatedTypeBuilder = NewAnnotatedTypeBuilder.newInstance(pat.getAnnotatedType()).readAnnotationsFromUnderlying();
+            AnnotatedTypeBuilder<X> annotatedTypeBuilder = AnnotatedTypeBuilder.newInstance(pat.getAnnotatedType()).readAnnotationsFromUnderlyingType();
             // remove class-level @Named annotation
             annotatedTypeBuilder.removeFromClass(Named.class);
             // remove bean constructors annotated @Inject

Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedCallable.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedCallable.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedCallable.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -1,79 +0,0 @@
-/*
- * 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.extensions.util.annotated;
-
-import java.lang.reflect.Member;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import javax.enterprise.inject.spi.AnnotatedCallable;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.AnnotatedType;
-
-/**
- * 
- * @author Stuart Douglas
- * 
- */
-abstract class AbstractNewAnnotatedCallable<X, Y extends Member> extends AbstractNewAnnotatedMember<X, Y> implements AnnotatedCallable<X>
-{
-
-   private final List<AnnotatedParameter<X>> parameters;
-
-   protected AbstractNewAnnotatedCallable(AnnotatedType<X> declaringType, Y member, Class<?> memberType, Class<?>[] parameterTypes, Type[] genericTypes, AnnotationStore annotations, Map<Integer, AnnotationStore> parameterAnnotations, Type genericType, Map<Integer, Type> parameterTypeOverrides)
-   {
-      super(declaringType, member, memberType, annotations, genericType, null);
-      this.parameters = getAnnotatedParameters(this, parameterTypes, genericTypes, parameterAnnotations, parameterTypeOverrides);
-   }
-
-   public List<AnnotatedParameter<X>> getParameters()
-   {
-      return Collections.unmodifiableList(parameters);
-   }
-
-   public AnnotatedParameter<X> getParameter(int index)
-   {
-      return parameters.get(index);
-
-   }  
-   
-   private static <X, Y extends Member> List<AnnotatedParameter<X>> getAnnotatedParameters(AbstractNewAnnotatedCallable<X, Y> callable, Class<?>[] parameterTypes, Type[] genericTypes, Map<Integer, AnnotationStore> parameterAnnotations, Map<Integer, Type> parameterTypeOverrides)
-   {
-      List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>();
-      int len = parameterTypes.length;
-      for (int i = 0; i < len; ++i)
-      {
-         AnnotationBuilder builder = new AnnotationBuilder();
-         if (parameterAnnotations != null && parameterAnnotations.containsKey(i))
-         {
-            builder.addAll(parameterAnnotations.get(i));
-         }
-         Type over = null;
-         if (parameterTypeOverrides != null)
-         {
-            over = parameterTypeOverrides.get(i);
-         }
-         NewAnnotatedParameter<X> p = new NewAnnotatedParameter<X>(callable, parameterTypes[i], i, builder.create(), genericTypes[i], over);
-         parameters.add(p);
-      }
-      return parameters;
-   }
-
-}

Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedElement.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedElement.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedElement.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -1,98 +0,0 @@
-/*
- * 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.extensions.util.annotated;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.Annotated;
-
-/**
- * The base class for all New Annotated types.
- * 
- * @author Stuart Douglas
- * 
- */
-abstract class AbstractNewAnnotatedElement implements Annotated
-{
-
-   private final Type type;
-   private final Set<Type> typeClosure;
-   private final AnnotationStore annotations;
-
-   protected AbstractNewAnnotatedElement(Class<?> type, AnnotationStore annotations, Type genericType, Type overridenType)
-   {
-
-      if (overridenType == null)
-      {
-         this.typeClosure = new TypeClosureBuilder().add(type).getTypes();
-         if (genericType != null)
-         {
-            typeClosure.add(genericType);
-            this.type = genericType;
-         }
-         else
-         {
-            this.type = type;
-         }
-      }
-      else
-      {
-         this.type = overridenType;
-         this.typeClosure = Collections.singleton(overridenType);
-      }
-
-
-      if (annotations == null)
-      {
-         this.annotations = new AnnotationStore();
-      }
-      else
-      {
-         this.annotations = annotations;
-      }
-   }
-
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
-   {
-      return annotations.getAnnotation(annotationType);
-   }
-
-   public Set<Annotation> getAnnotations()
-   {
-      return annotations.getAnnotations();
-   }
-
-   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
-   {
-      return annotations.isAnnotationPresent(annotationType);
-   }
-
-   public Set<Type> getTypeClosure()
-   {
-      return new HashSet<Type>(typeClosure);
-   }
-
-   public Type getBaseType()
-   {
-      return type;
-   }
-
-}

Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedMember.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedMember.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedMember.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -1,58 +0,0 @@
-/*
- * 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.extensions.util.annotated;
-
-import java.lang.reflect.Member;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-
-import javax.enterprise.inject.spi.AnnotatedMember;
-import javax.enterprise.inject.spi.AnnotatedType;
-
-/**
- * 
- * @author Stuart Douglas
- * 
- */
-abstract class AbstractNewAnnotatedMember<X, M extends Member> extends AbstractNewAnnotatedElement implements AnnotatedMember<X>
-{
-   private final AnnotatedType<X> declaringType;
-   private final M javaMember;
-
-   protected AbstractNewAnnotatedMember(AnnotatedType<X> declaringType, M member, Class<?> memberType, AnnotationStore annotations, Type genericType, Type overridenType)
-   {
-      super(memberType, annotations, genericType, overridenType);
-      this.declaringType = declaringType;
-      this.javaMember = member;
-   }
-
-   public AnnotatedType<X> getDeclaringType()
-   {
-      return declaringType;
-   }
-
-   public M getJavaMember()
-   {
-      return javaMember;
-   }
-
-   public boolean isStatic()
-   {
-      return Modifier.isStatic(javaMember.getModifiers());
-   }
-
-}

Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedCallableImpl.java (from rev 6191, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedCallable.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedCallableImpl.java	                        (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedCallableImpl.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -0,0 +1,79 @@
+/*
+ * 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.extensions.util.annotated;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+abstract class AnnotatedCallableImpl<X, Y extends Member> extends AnnotatedMemberImpl<X, Y> implements AnnotatedCallable<X>
+{
+
+   private final List<AnnotatedParameter<X>> parameters;
+
+   protected AnnotatedCallableImpl(AnnotatedType<X> declaringType, Y member, Class<?> memberType, Class<?>[] parameterTypes, Type[] genericTypes, AnnotationStore annotations, Map<Integer, AnnotationStore> parameterAnnotations, Type genericType, Map<Integer, Type> parameterTypeOverrides)
+   {
+      super(declaringType, member, memberType, annotations, genericType, null);
+      this.parameters = getAnnotatedParameters(this, parameterTypes, genericTypes, parameterAnnotations, parameterTypeOverrides);
+   }
+
+   public List<AnnotatedParameter<X>> getParameters()
+   {
+      return Collections.unmodifiableList(parameters);
+   }
+
+   public AnnotatedParameter<X> getParameter(int index)
+   {
+      return parameters.get(index);
+
+   }  
+   
+   private static <X, Y extends Member> List<AnnotatedParameter<X>> getAnnotatedParameters(AnnotatedCallableImpl<X, Y> callable, Class<?>[] parameterTypes, Type[] genericTypes, Map<Integer, AnnotationStore> parameterAnnotations, Map<Integer, Type> parameterTypeOverrides)
+   {
+      List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>();
+      int len = parameterTypes.length;
+      for (int i = 0; i < len; ++i)
+      {
+         AnnotationBuilder builder = new AnnotationBuilder();
+         if (parameterAnnotations != null && parameterAnnotations.containsKey(i))
+         {
+            builder.addAll(parameterAnnotations.get(i));
+         }
+         Type over = null;
+         if (parameterTypeOverrides != null)
+         {
+            over = parameterTypeOverrides.get(i);
+         }
+         AnnotatedParameterImpl<X> p = new AnnotatedParameterImpl<X>(callable, parameterTypes[i], i, builder.create(), genericTypes[i], over);
+         parameters.add(p);
+      }
+      return parameters;
+   }
+
+}


Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedCallableImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedConstructorImpl.java (from rev 6191, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedConstructor.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedConstructorImpl.java	                        (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedConstructorImpl.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -0,0 +1,58 @@
+/*
+ * 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.extensions.util.annotated;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+
+/**
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+class AnnotatedConstructorImpl<X> extends AnnotatedCallableImpl<X, Constructor<X>> implements AnnotatedConstructor<X>
+{
+
+   AnnotatedConstructorImpl(AnnotatedTypeImpl<X> type, Constructor<?> constructor, AnnotationStore annotations, Map<Integer, AnnotationStore> parameterAnnotations, Map<Integer, Type> typeOverrides)
+   {
+
+      super(type, (Constructor<X>) constructor, constructor.getDeclaringClass(), constructor.getParameterTypes(), getGenericArray(constructor), annotations, parameterAnnotations, null, typeOverrides);
+   }
+
+   private static Type[] getGenericArray(Constructor<?> constructor)
+   {
+      Type[] genericTypes = constructor.getGenericParameterTypes();
+      // for inner classes genericTypes and parameterTypes can be different
+      // length, this is a hack to fix this.
+      // TODO: investigate this behavior further, on different JVM's and
+      // compilers
+      if (genericTypes.length + 1 == constructor.getParameterTypes().length)
+      {
+         genericTypes = new Type[constructor.getGenericParameterTypes().length + 1];
+         genericTypes[0] = constructor.getParameterTypes()[0];
+         for (int i = 0; i < constructor.getGenericParameterTypes().length; ++i)
+         {
+            genericTypes[i + 1] = constructor.getGenericParameterTypes()[i];
+         }
+      }
+      return genericTypes;
+   }
+
+}


Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedConstructorImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedFieldImpl.java (from rev 6191, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedField.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedFieldImpl.java	                        (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedFieldImpl.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -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.extensions.util.annotated;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * 
+ * @author Stuart Douglas
+ *
+ */
+class AnnotatedFieldImpl<X> extends AnnotatedMemberImpl<X, Field> implements AnnotatedField<X>
+{
+
+   AnnotatedFieldImpl(AnnotatedType<X> declaringType, Field field, AnnotationStore annotations, Type overridenType)
+   {
+      super(declaringType, field, field.getType(), annotations, field.getGenericType(), overridenType);
+   }
+
+}


Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedFieldImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedImpl.java (from rev 6191, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedElement.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedImpl.java	                        (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedImpl.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -0,0 +1,98 @@
+/*
+ * 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.extensions.util.annotated;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Annotated;
+
+/**
+ * The base class for all New Annotated types.
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+abstract class AnnotatedImpl implements Annotated
+{
+
+   private final Type type;
+   private final Set<Type> typeClosure;
+   private final AnnotationStore annotations;
+
+   protected AnnotatedImpl(Class<?> type, AnnotationStore annotations, Type genericType, Type overridenType)
+   {
+
+      if (overridenType == null)
+      {
+         this.typeClosure = new TypeClosureBuilder().add(type).getTypes();
+         if (genericType != null)
+         {
+            typeClosure.add(genericType);
+            this.type = genericType;
+         }
+         else
+         {
+            this.type = type;
+         }
+      }
+      else
+      {
+         this.type = overridenType;
+         this.typeClosure = Collections.singleton(overridenType);
+      }
+
+
+      if (annotations == null)
+      {
+         this.annotations = new AnnotationStore();
+      }
+      else
+      {
+         this.annotations = annotations;
+      }
+   }
+
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      return annotations.getAnnotation(annotationType);
+   }
+
+   public Set<Annotation> getAnnotations()
+   {
+      return annotations.getAnnotations();
+   }
+
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return annotations.isAnnotationPresent(annotationType);
+   }
+
+   public Set<Type> getTypeClosure()
+   {
+      return new HashSet<Type>(typeClosure);
+   }
+
+   public Type getBaseType()
+   {
+      return type;
+   }
+
+}


Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedMemberImpl.java (from rev 6191, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedMember.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedMemberImpl.java	                        (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedMemberImpl.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -0,0 +1,58 @@
+/*
+ * 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.extensions.util.annotated;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+abstract class AnnotatedMemberImpl<X, M extends Member> extends AnnotatedImpl implements AnnotatedMember<X>
+{
+   private final AnnotatedType<X> declaringType;
+   private final M javaMember;
+
+   protected AnnotatedMemberImpl(AnnotatedType<X> declaringType, M member, Class<?> memberType, AnnotationStore annotations, Type genericType, Type overridenType)
+   {
+      super(memberType, annotations, genericType, overridenType);
+      this.declaringType = declaringType;
+      this.javaMember = member;
+   }
+
+   public AnnotatedType<X> getDeclaringType()
+   {
+      return declaringType;
+   }
+
+   public M getJavaMember()
+   {
+      return javaMember;
+   }
+
+   public boolean isStatic()
+   {
+      return Modifier.isStatic(javaMember.getModifiers());
+   }
+
+}


Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedMemberImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedMethodImpl.java (from rev 6191, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedMethod.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedMethodImpl.java	                        (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedMethodImpl.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -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.extensions.util.annotated;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+class AnnotatedMethodImpl<X> extends AnnotatedCallableImpl<X, Method> implements AnnotatedMethod<X>
+{
+   AnnotatedMethodImpl(AnnotatedType<X> type, Method method, AnnotationStore annotations, Map<Integer, AnnotationStore> parameterAnnotations, Map<Integer, Type> parameterTypeOverrides)
+   {
+      super(type, method, method.getReturnType(), method.getParameterTypes(), method.getGenericParameterTypes(), annotations, parameterAnnotations, method.getGenericReturnType(), parameterTypeOverrides);
+   }
+
+}


Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedMethodImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedParameterImpl.java (from rev 6191, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedParameter.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedParameterImpl.java	                        (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedParameterImpl.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -0,0 +1,52 @@
+/*
+ * 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.extensions.util.annotated;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+/**
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+class AnnotatedParameterImpl<X> extends AnnotatedImpl implements AnnotatedParameter<X>
+{
+
+   private final int position;
+   private final AnnotatedCallable<X> declaringCallable;
+
+   AnnotatedParameterImpl(AnnotatedCallable<X> declaringCallable, Class<?> type, int position, AnnotationStore annotations, Type genericType, Type typeOverride)
+   {
+      super(type, annotations, genericType, typeOverride);
+      this.declaringCallable = declaringCallable;
+      this.position = position;
+   }
+
+   public AnnotatedCallable<X> getDeclaringCallable()
+   {
+      return declaringCallable;
+   }
+
+   public int getPosition()
+   {
+      return position;
+   }
+
+}


Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedParameterImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedTypeBuilder.java (from rev 6196, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedTypeBuilder.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedTypeBuilder.java	                        (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedTypeBuilder.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -0,0 +1,525 @@
+/*
+ * 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.extensions.util.annotated;
+
+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.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.enterprise.inject.spi.Annotated;
+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.extensions.util.ReflectionUtils;
+
+/**
+ * Class for constructing a new AnnotatedType. A new instance of builder must be
+ * used for each annotated type.
+ * 
+ * In can either be created with no annotations, or the annotations can be read
+ * from the underlying class or an AnnotatedType
+ * 
+ * @author Stuart Douglas
+ * @author Pete Muir
+ * 
+ */
+public class AnnotatedTypeBuilder<X>
+{
+   
+
+   public static <X> AnnotatedTypeBuilder<X> newInstance(Class<X> underlying)
+   {
+      return new AnnotatedTypeBuilder<X>(underlying);
+   }
+
+   public static <X> AnnotatedTypeBuilder<X> newInstance(AnnotatedType<X> underlying)
+   {
+      return new AnnotatedTypeBuilder<X>(underlying);
+   }
+   
+   private final Class<X> underlyingType;
+   private final AnnotationBuilder typeAnnotations;
+   
+   private final Map<Constructor<?>, AnnotationBuilder> constructors;
+   private final Map<Constructor<?>, Map<Integer, AnnotationBuilder>> constructorParameters;
+   private Map<Constructor<?>, Map<Integer, Type>> constructorParameterTypes;
+   
+   private final Map<Field, AnnotationBuilder> fields;
+   private final Map<Field, Type> fieldTypes;
+   
+   private final Map<Method, AnnotationBuilder> methods;
+   private final Map<Method, Map<Integer, AnnotationBuilder>> methodParameters;
+   private final Map<Method, Map<Integer, Type>> methodParameterTypes;
+
+   protected AnnotatedTypeBuilder(Class<X> underlyingType)
+   {
+      this.underlyingType = underlyingType;
+      this.typeAnnotations = new AnnotationBuilder();
+      this.constructors = new HashMap<Constructor<?>, AnnotationBuilder>();
+      this.constructorParameters = new HashMap<Constructor<?>, Map<Integer,AnnotationBuilder>>();
+      this.constructorParameterTypes = new HashMap<Constructor<?>, Map<Integer,Type>>();
+      this.fields = new HashMap<Field, AnnotationBuilder>();
+      this.fieldTypes = new HashMap<Field, Type>();
+      this.methods = new HashMap<Method, AnnotationBuilder>();
+      this.methodParameters = new HashMap<Method, Map<Integer,AnnotationBuilder>>();
+      this.methodParameterTypes = new HashMap<Method, Map<Integer,Type>>();
+   }
+
+   protected AnnotatedTypeBuilder(AnnotatedType<X> underlyingType)
+   {
+      this(underlyingType.getJavaClass());
+
+   }
+
+   public AnnotatedTypeBuilder<X> readAnnotationsFromUnderlyingType()
+   {
+      for (Annotation annotation : underlyingType.getAnnotations())
+      {
+         typeAnnotations.add(annotation);
+      }
+
+      for (Field field : ReflectionUtils.getFields(underlyingType))
+      {
+         AnnotationBuilder annotationBuilder = new AnnotationBuilder();
+         fields.put(field, annotationBuilder);
+         field.setAccessible(true);
+         for (Annotation annotation : field.getAnnotations())
+         {
+            annotationBuilder.add(annotation);
+         }
+      }
+
+      for (Method method : ReflectionUtils.getMethods(underlyingType))
+      {
+         AnnotationBuilder annotationBuilder = new AnnotationBuilder();
+         method.setAccessible(true);
+         methods.put(method, annotationBuilder);
+         for (Annotation annotation : method.getAnnotations())
+         {
+            annotationBuilder.add(annotation);
+         }
+         Map<Integer, AnnotationBuilder> parameters = new HashMap<Integer, AnnotationBuilder>();
+         methodParameters.put(method, parameters);
+         for (int i = 0; i < method.getParameterTypes().length; ++i)
+         {
+            AnnotationBuilder parameterAnnotationBuilder = new AnnotationBuilder();
+            parameters.put(i, parameterAnnotationBuilder);
+            for (Annotation annotation : method.getParameterAnnotations()[i])
+            {
+               parameterAnnotationBuilder.add(annotation);
+            }
+         }
+      }
+
+      for (Constructor<?> constructor : underlyingType.getDeclaredConstructors())
+      {
+         AnnotationBuilder annotationBuilder = new AnnotationBuilder();
+         constructor.setAccessible(true);
+         constructors.put(constructor, annotationBuilder);
+         for (Annotation annotation : constructor.getAnnotations())
+         {
+            annotationBuilder.add(annotation);
+         }
+         Map<Integer, AnnotationBuilder> mparams = new HashMap<Integer, AnnotationBuilder>();
+         constructorParameters.put(constructor, mparams);
+         for (int i = 0; i < constructor.getParameterTypes().length; ++i)
+         {
+            AnnotationBuilder parameterAnnotationBuilder = new AnnotationBuilder();
+            mparams.put(i, parameterAnnotationBuilder);
+            for (Annotation annotation : constructor.getParameterAnnotations()[i])
+            {
+               parameterAnnotationBuilder.add(annotation);
+            }
+         }
+      }
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> addToClass(Annotation annotation)
+   {
+      typeAnnotations.add(annotation);
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> removeFromClass(Class<? extends Annotation> annotation)
+   {
+      typeAnnotations.remove(annotation);
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> addToField(Field field, Annotation annotation)
+   {
+      if (fields.get(field) == null)
+      {
+         fields.put(field, new AnnotationBuilder());
+      }
+      fields.get(field).add(annotation);
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> removeFromField(Field field, Class<? extends Annotation> annotation)
+   {
+      if (fields.get(field) != null)
+      {
+         fields.get(field).remove(annotation);
+      }
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> addToMethod(Method method, Annotation annotation)
+   {
+      if (methods.get(method) == null)
+      {
+         methods.put(method, new AnnotationBuilder());
+      }
+      methods.get(method).add(annotation);
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> removeFromMethod(Method method, Class<? extends Annotation> annotation)
+   {
+      if (methods.get(method) != null)
+      {
+         methods.get(method).remove(annotation);
+      }
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> addToMethodParameter(Method method, int position, Annotation annotation)
+   {
+      if (!methods.containsKey(method))
+      {
+         methods.put(method, new AnnotationBuilder());
+      }
+      if (methodParameters.get(method) == null)
+      {
+         methodParameters.put(method, new HashMap<Integer, AnnotationBuilder>());
+      }
+      if (methodParameters.get(method).get(position) == null)
+      {
+         methodParameters.get(method).put(position, new AnnotationBuilder());
+      }
+      methodParameters.get(method).get(position).add(annotation);
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> removeFromMethodParameter(Method method, int position, Class<? extends Annotation> annotation)
+   {
+      if (methodParameters.get(method) != null)
+      {
+         if (methodParameters.get(method).get(position) != null)
+         {
+            methodParameters.get(method).get(position).remove(annotation);
+         }
+      }
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> addToConstructor(Constructor<X> constructor, Annotation annotation)
+   {
+      if (constructors.get(constructor) == null)
+      {
+         constructors.put(constructor, new AnnotationBuilder());
+      }
+      constructors.get(constructor).add(annotation);
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> removeFromConstructor(Constructor<?> constructor, Class<? extends Annotation> annotation)
+   {
+      if (constructors.get(constructor) != null)
+      {
+         constructors.get(constructor).remove(annotation);
+      }
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> addToConstructorParameter(Constructor<X> constructor, int position, Annotation annotation)
+   {
+      if (!constructors.containsKey(constructor))
+      {
+         constructors.put(constructor, new AnnotationBuilder());
+      }
+      if (constructorParameters.get(constructor) == null)
+      {
+         constructorParameters.put(constructor, new HashMap<Integer, AnnotationBuilder>());
+      }
+      if (constructorParameters.get(constructor).get(position) == null)
+      {
+         constructorParameters.get(constructor).put(position, new AnnotationBuilder());
+      }
+      constructorParameters.get(constructor).get(position).add(annotation);
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> removeFromConstructorParameter(Constructor<X> constructor, int position, Class<? extends Annotation> annotation)
+   {
+      if (constructorParameters.get(constructor) != null)
+      {
+         if (constructorParameters.get(constructor).get(position) != null)
+         {
+            constructorParameters.get(constructor).get(position).remove(annotation);
+         }
+      }
+      return this;
+   }
+
+   public AnnotatedTypeBuilder<X> removeFromAll(Class<? extends Annotation> annotation)
+   {
+      removeFromClass(annotation);
+      for (Entry<Field, AnnotationBuilder> field : fields.entrySet())
+      {
+         field.getValue().remove(annotation);
+      }
+      for (Entry<Method, AnnotationBuilder> method : methods.entrySet())
+      {
+         method.getValue().remove(annotation);
+         if (methodParameters.get(method.getKey()) != null)
+         {
+            for (Entry<Integer, AnnotationBuilder> parameter : methodParameters.get(method.getKey()).entrySet())
+            {
+               parameter.getValue().remove(annotation);
+            }
+         }
+      }
+      for (Entry<Constructor<?>, AnnotationBuilder> constructor : constructors.entrySet())
+      {
+         constructor.getValue().remove(annotation);
+         if (constructorParameters.get(constructor.getKey()) != null)
+         {
+            for (Entry<Integer, AnnotationBuilder> parameter : constructorParameters.get(constructor.getKey()).entrySet())
+            {
+               parameter.getValue().remove(annotation);
+            }
+         }
+      }
+      return this;
+   }
+
+   public <T extends Annotation> AnnotatedTypeBuilder<X> redefineMemberParameters(Class<T> annotationType, ParameterAnnotationRedefiner<T> redefinition)
+   {
+      for (Entry<Method, AnnotationBuilder> method : methods.entrySet())
+      {
+         if (methodParameters.get(method.getKey()) != null)
+         {
+            for (Entry<Integer, AnnotationBuilder> parameter : methodParameters.get(method.getKey()).entrySet())
+            {
+               redefineAnnotationBuilder(annotationType, redefinition, new Parameter(method.getKey(), parameter.getKey()), parameter.getValue());
+            }
+         }
+      }
+      for (Entry<Constructor<?>, AnnotationBuilder> constructor : constructors.entrySet())
+      {
+         if (constructorParameters.get(constructor.getKey()) != null)
+         {
+            for (Entry<Integer, AnnotationBuilder> parameter : constructorParameters.get(constructor.getKey()).entrySet())
+            {
+               redefineAnnotationBuilder(annotationType, redefinition, new Parameter(constructor.getKey(), parameter.getKey()), parameter.getValue());
+            }
+         }
+      }
+      return this;
+   }
+   
+   public <T extends Annotation> AnnotatedTypeBuilder<X> redefineMembers(Class<T> annotationType, MemberAnnotationRedefiner<T> redefinition)
+   {
+      for (Entry<Field, AnnotationBuilder> field : fields.entrySet())
+      {
+         redefineAnnotationBuilder(annotationType, redefinition, field.getKey(), field.getValue());
+      }
+      for (Entry<Method, AnnotationBuilder> method : methods.entrySet())
+      {
+         redefineAnnotationBuilder(annotationType, redefinition, method.getKey(), method.getValue());
+      }
+      for (Entry<Constructor<?>, AnnotationBuilder> constructor : constructors.entrySet())
+      {
+         redefineAnnotationBuilder(annotationType, redefinition, constructor.getKey(), constructor.getValue());
+      }
+      return this;
+   }
+
+   protected <T extends Annotation, A> void redefineAnnotationBuilder(Class<T> annotationType, AnnotationRedefiner<T, A> redefinition, A annotated, AnnotationBuilder builder)
+   {
+      if (builder.isAnnotationPresent(annotationType))
+      {
+         builder.remove(annotationType);
+         T redefinedAnnotation = redefinition.redefine(builder.getAnnotation(annotationType), annotated, builder);
+         if (redefinedAnnotation != null)
+         {
+            builder.add(redefinedAnnotation);
+         }
+      }
+   }
+
+   /**
+    * merges the annotations from an existing AnnotatedType. If they both have
+    * the same annotation on an element overwriteExisting determines which one
+    * to keep
+    * 
+    * @param type
+    * @param overwriteExisting
+    * @return
+    */
+   public AnnotatedTypeBuilder<X> mergeAnnotations(AnnotatedType<X> type, boolean overwriteExisting)
+   {
+      mergeAnnotationsOnElement(type, overwriteExisting, typeAnnotations);
+      for (AnnotatedField<? super X> field : type.getFields())
+      { 
+         if (fields.get(field.getJavaMember()) == null)
+         {
+            fields.put(field.getJavaMember(), new AnnotationBuilder());
+         }
+         mergeAnnotationsOnElement(field, overwriteExisting, fields.get(field.getJavaMember()));
+      }
+      for (AnnotatedMethod<? super X> method : type.getMethods())
+      {
+         if (methods.get(method.getJavaMember()) == null)
+         {
+            methods.put(method.getJavaMember(), new AnnotationBuilder());
+         }
+         mergeAnnotationsOnElement(method, overwriteExisting, methods.get(method.getJavaMember()));
+         for (AnnotatedParameter<? super X> p : method.getParameters())
+         {
+            if (methodParameters.get(method.getJavaMember()) == null)
+            {
+               methodParameters.put(method.getJavaMember(), new HashMap<Integer, AnnotationBuilder>());
+            }
+            if (methodParameters.get(method.getJavaMember()).get(p.getPosition()) == null)
+            {
+               methodParameters.get(method.getJavaMember()).put(p.getPosition(),  new AnnotationBuilder());
+            }
+            mergeAnnotationsOnElement(p, overwriteExisting, methodParameters.get(method.getJavaMember()).get(p.getPosition()));
+         }
+      }
+      for (AnnotatedConstructor<? super X> constructor : type.getConstructors())
+      {
+         if (constructors.get(constructor.getJavaMember()) == null)
+         {
+            constructors.put(constructor.getJavaMember(), new AnnotationBuilder());
+         }
+         mergeAnnotationsOnElement(constructor, overwriteExisting, constructors.get(constructor.getJavaMember()));
+         for (AnnotatedParameter<? super X> p : constructor.getParameters())
+         {
+            if (constructorParameters.get(constructor.getJavaMember()) == null)
+            {
+               constructorParameters.put(constructor.getJavaMember(), new HashMap<Integer, AnnotationBuilder>());
+            }
+            if (constructorParameters.get(constructor.getJavaMember()).get(p.getPosition()) == null)
+            {
+               constructorParameters.get(constructor.getJavaMember()).put(p.getPosition(), new AnnotationBuilder());
+            }
+            mergeAnnotationsOnElement(p, overwriteExisting, constructorParameters.get(constructor.getJavaMember()).get(p.getPosition()));
+         }
+      }
+      return this;
+   }
+
+   protected void mergeAnnotationsOnElement(Annotated annotated, boolean overwriteExisting, AnnotationBuilder typeAnnotations)
+   {
+      for (Annotation annotation : annotated.getAnnotations())
+      {
+         if (typeAnnotations.getAnnotation(annotation.annotationType()) != null)
+         {
+            if (overwriteExisting)
+            {
+               typeAnnotations.remove(annotation.annotationType());
+               typeAnnotations.add(annotation);
+            }
+         }
+         else
+         {
+            typeAnnotations.add(annotation);
+         }
+      }
+   }
+
+   public AnnotatedType<X> create()
+   {
+      Map<Constructor<?>, Map<Integer, AnnotationStore>> constructorParameterAnnnotations = new HashMap<Constructor<?>, Map<Integer, AnnotationStore>>();
+      Map<Constructor<?>, AnnotationStore> constructorAnnotations = new HashMap<Constructor<?>, AnnotationStore>();
+      Map<Method, Map<Integer, AnnotationStore>> methodParameterAnnnotations = new HashMap<Method, Map<Integer, AnnotationStore>>();
+      Map<Method, AnnotationStore> methodAnnotations = new HashMap<Method, AnnotationStore>();
+      Map<Field, AnnotationStore> fieldAnnotations = new HashMap<Field, AnnotationStore>();
+
+      for (Entry<Field, AnnotationBuilder> field : fields.entrySet())
+      {
+         fieldAnnotations.put(field.getKey(), field.getValue().create());
+      }
+
+      for (Entry<Method, AnnotationBuilder> method : methods.entrySet())
+      {
+         methodAnnotations.put(method.getKey(), method.getValue().create());
+      }
+      for (Entry<Method, Map<Integer, AnnotationBuilder>> parameters : methodParameters.entrySet())
+      {
+         Map<Integer, AnnotationStore> parameterAnnotations = new HashMap<Integer, AnnotationStore>();
+         methodParameterAnnnotations.put(parameters.getKey(), parameterAnnotations);
+         for (Entry<Integer, AnnotationBuilder> parameter : parameters.getValue().entrySet())
+         {
+            parameterAnnotations.put(parameter.getKey(), parameter.getValue().create());
+         }
+      }
+
+      for (Entry<Constructor<?>, AnnotationBuilder> constructor : constructors.entrySet())
+      {
+         constructorAnnotations.put(constructor.getKey(), constructor.getValue().create());
+      }
+      for (Entry<Constructor<?>, Map<Integer, AnnotationBuilder>> parameters : constructorParameters.entrySet())
+      {
+         Map<Integer, AnnotationStore> parameterAnnotations = new HashMap<Integer, AnnotationStore>();
+         constructorParameterAnnnotations.put(parameters.getKey(), parameterAnnotations);
+         for (Entry<Integer, AnnotationBuilder> parameter : parameters.getValue().entrySet())
+         {
+            parameterAnnotations.put(parameter.getKey(), parameter.getValue().create());
+         }
+      }
+
+      return new AnnotatedTypeImpl<X>(underlyingType, typeAnnotations.create(), fieldAnnotations, methodAnnotations, methodParameterAnnnotations, constructorAnnotations, constructorParameterAnnnotations, fieldTypes, methodParameterTypes, constructorParameterTypes);
+   }
+
+   public void overrideFieldType(Field field, Type type)
+   {
+      fieldTypes.put(field, type);
+   }
+
+   public void overrideMethodParameterType(Method method, Type type, int position)
+   {
+      if (methodParameterTypes.get(method) == null)
+      {
+         methodParameterTypes.put(method, new HashMap<Integer, Type>());
+      }
+      methodParameterTypes.get(method).put(position, type);
+   }
+
+   public void overrideConstructorParameterType(Constructor<?> constructor, Type type, int position)
+   {
+      if (constructorParameterTypes.get(constructor) == null)
+      {
+         constructorParameterTypes.put(constructor, new HashMap<Integer, Type>());
+      }
+      constructorParameterTypes.get(constructor).put(position, type);
+   }
+
+}


Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedTypeBuilder.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedTypeImpl.java (from rev 6191, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedType.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedTypeImpl.java	                        (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedTypeImpl.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -0,0 +1,130 @@
+/*
+ * 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.extensions.util.annotated;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * AnnotatedType implementation for adding beans in the BeforeBeanDiscovery
+ * event
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+class AnnotatedTypeImpl<X> extends AnnotatedImpl implements AnnotatedType<X>
+{
+
+   private final Set<AnnotatedConstructor<X>> constructors;
+   private final Set<AnnotatedField<? super X>> fields;
+   private final Set<AnnotatedMethod<? super X>> methods;
+
+   private final Class<X> javaClass;
+
+   /**
+    * We make sure that there is a NewAnnotatedMember for every public
+    * method/field/constructor
+    * 
+    * If annotation have been added to other methods as well we add them to
+    * 
+    */
+   AnnotatedTypeImpl(Class<X> clazz, AnnotationStore typeAnnotations, Map<Field, AnnotationStore> fieldAnnotations, Map<Method, AnnotationStore> methodAnnotations, Map<Method, Map<Integer, AnnotationStore>> methodParameterAnnotations, Map<Constructor<?>, AnnotationStore> constructorAnnotations, Map<Constructor<?>, Map<Integer, AnnotationStore>> constructorParameterAnnotations, Map<Field, Type> fieldTypes, Map<Method, Map<Integer, Type>> methodParameterTypes, Map<Constructor<?>, Map<Integer, Type>> constructorParameterTypes)
+   {
+      super(clazz, typeAnnotations, null, null);
+      this.javaClass = clazz;
+      this.constructors = new HashSet<AnnotatedConstructor<X>>();
+      Set<Constructor<?>> cset = new HashSet<Constructor<?>>();
+      Set<Method> mset = new HashSet<Method>();
+      Set<Field> fset = new HashSet<Field>();
+      for (Constructor<?> c : clazz.getConstructors())
+      {
+         AnnotatedConstructor<X> nc = new AnnotatedConstructorImpl<X>(this, c, constructorAnnotations.get(c), constructorParameterAnnotations.get(c), constructorParameterTypes.get(c));
+         constructors.add(nc);
+         cset.add(c);
+      }
+      for (Entry<Constructor<?>, AnnotationStore> c : constructorAnnotations.entrySet())
+      {
+         if (!cset.contains(c.getKey()))
+         {
+            AnnotatedConstructor<X> nc = new AnnotatedConstructorImpl<X>(this, c.getKey(), c.getValue(), constructorParameterAnnotations.get(c.getKey()), constructorParameterTypes.get(c.getKey()));
+            constructors.add(nc);
+         }
+      }
+      this.methods = new HashSet<AnnotatedMethod<? super X>>();
+      for (Method m : clazz.getMethods())
+      {
+         AnnotatedMethodImpl<X> met = new AnnotatedMethodImpl<X>(this, m, methodAnnotations.get(m), methodParameterAnnotations.get(m), methodParameterTypes.get(m));
+         methods.add(met);
+         mset.add(m);
+      }
+      for (Entry<Method, AnnotationStore> c : methodAnnotations.entrySet())
+      {
+         if (!mset.contains(c.getKey()))
+         {
+            AnnotatedMethodImpl<X> nc = new AnnotatedMethodImpl<X>(this, c.getKey(), c.getValue(), methodParameterAnnotations.get(c.getKey()), methodParameterTypes.get(c.getKey()));
+            methods.add(nc);
+         }
+      }
+      this.fields = new HashSet<AnnotatedField<? super X>>();
+      for (Field f : clazz.getFields())
+      {
+         AnnotatedField<X> b = new AnnotatedFieldImpl<X>(this, f, fieldAnnotations.get(f), fieldTypes.get(f));
+         fields.add(b);
+         fset.add(f);
+      }
+      for (Entry<Field, AnnotationStore> e : fieldAnnotations.entrySet())
+      {
+         if (!fset.contains(e.getKey()))
+         {
+            fields.add(new AnnotatedFieldImpl<X>(this, e.getKey(), e.getValue(), fieldTypes.get(e.getKey())));
+         }
+      }
+   }
+
+   public Set<AnnotatedConstructor<X>> getConstructors()
+   {
+      return Collections.unmodifiableSet(constructors);
+   }
+
+   public Set<AnnotatedField<? super X>> getFields()
+   {
+      return Collections.unmodifiableSet(fields);
+   }
+
+   public Class<X> getJavaClass()
+   {
+      return javaClass;
+   }
+
+   public Set<AnnotatedMethod<? super X>> getMethods()
+   {
+      return Collections.unmodifiableSet(methods);
+   }
+
+}


Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotatedTypeImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotationBuilder.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotationBuilder.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotationBuilder.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -30,31 +30,31 @@
  */
 public class AnnotationBuilder
 {
-   private HashMap<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
-   private Set<Annotation> annotationSet = new HashSet<Annotation>();
+   private final HashMap<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+   private final Set<Annotation> annotationSet = new HashSet<Annotation>();
 
-   public AnnotationBuilder add(Annotation a)
+   public AnnotationBuilder add(Annotation annotation)
    {
-      annotationSet.add(a);
-      annotationMap.put(a.annotationType(), a);
+      annotationSet.add(annotation);
+      annotationMap.put(annotation.annotationType(), annotation);
       return this;
    }
 
-   public void remove(Class<? extends Annotation> a)
+   public void remove(Class<? extends Annotation> annotation)
    {
       Iterator<Annotation> it = annotationSet.iterator();
       while (it.hasNext())
       {
          Annotation an = it.next();
-         if (a.isAssignableFrom(an.annotationType()))
+         if (annotation.isAssignableFrom(an.annotationType()))
          {
             it.remove();
          }
       }
-      annotationMap.remove(a);
+      annotationMap.remove(annotation);
    }
 
-   public AnnotationStore create()
+   AnnotationStore create()
    {
       return new AnnotationStore(annotationMap, annotationSet);
    }

Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotationStore.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotationStore.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/AnnotationStore.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -45,17 +45,17 @@
       this.annotationSet = new HashSet<Annotation>();
    }
 
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   <T extends Annotation> T getAnnotation(Class<T> annotationType)
    {
       return annotationType.cast(annotationMap.get(annotationType));
    }
 
-   public Set<Annotation> getAnnotations()
+   Set<Annotation> getAnnotations()
    {
       return Collections.unmodifiableSet(annotationSet);
    }
 
-   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
    {
       return annotationMap.containsKey(annotationType);
    }

Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedConstructor.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedConstructor.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedConstructor.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -1,58 +0,0 @@
-/*
- * 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.extensions.util.annotated;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Type;
-import java.util.Map;
-
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-
-/**
- * 
- * @author Stuart Douglas
- * 
- */
-class NewAnnotatedConstructor<X> extends AbstractNewAnnotatedCallable<X, Constructor<X>> implements AnnotatedConstructor<X>
-{
-
-   NewAnnotatedConstructor(NewAnnotatedType<X> type, Constructor<?> constructor, AnnotationStore annotations, Map<Integer, AnnotationStore> parameterAnnotations, Map<Integer, Type> typeOverrides)
-   {
-
-      super(type, (Constructor<X>) constructor, constructor.getDeclaringClass(), constructor.getParameterTypes(), getGenericArray(constructor), annotations, parameterAnnotations, null, typeOverrides);
-   }
-
-   private static Type[] getGenericArray(Constructor<?> constructor)
-   {
-      Type[] genericTypes = constructor.getGenericParameterTypes();
-      // for inner classes genericTypes and parameterTypes can be different
-      // length, this is a hack to fix this.
-      // TODO: investigate this behaviour further, on different JVM's and
-      // compilers
-      if (genericTypes.length + 1 == constructor.getParameterTypes().length)
-      {
-         genericTypes = new Type[constructor.getGenericParameterTypes().length + 1];
-         genericTypes[0] = constructor.getParameterTypes()[0];
-         for (int i = 0; i < constructor.getGenericParameterTypes().length; ++i)
-         {
-            genericTypes[i + 1] = constructor.getGenericParameterTypes()[i];
-         }
-      }
-      return genericTypes;
-   }
-
-}

Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedField.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedField.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedField.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -1,38 +0,0 @@
-/*
- * 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.extensions.util.annotated;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Type;
-
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedType;
-
-/**
- * 
- * @author Stuart Douglas
- *
- */
-class NewAnnotatedField<X> extends AbstractNewAnnotatedMember<X, Field> implements AnnotatedField<X>
-{
-
-   NewAnnotatedField(AnnotatedType<X> declaringType, Field field, AnnotationStore annotations, Type overridenType)
-   {
-      super(declaringType, field, field.getType(), annotations, field.getGenericType(), overridenType);
-   }
-
-}

Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedMethod.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedMethod.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedMethod.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -1,38 +0,0 @@
-/*
- * 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.extensions.util.annotated;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Map;
-
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedType;
-
-/**
- * 
- * @author Stuart Douglas
- * 
- */
-class NewAnnotatedMethod<X> extends AbstractNewAnnotatedCallable<X, Method> implements AnnotatedMethod<X>
-{
-   NewAnnotatedMethod(AnnotatedType<X> type, Method method, AnnotationStore annotations, Map<Integer, AnnotationStore> parameterAnnotations, Map<Integer, Type> parameterTypeOverrides)
-   {
-      super(type, method, method.getReturnType(), method.getParameterTypes(), method.getGenericParameterTypes(), annotations, parameterAnnotations, method.getGenericReturnType(), parameterTypeOverrides);
-   }
-
-}

Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedParameter.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedParameter.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedParameter.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -1,52 +0,0 @@
-/*
- * 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.extensions.util.annotated;
-
-import java.lang.reflect.Type;
-
-import javax.enterprise.inject.spi.AnnotatedCallable;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-
-/**
- * 
- * @author Stuart Douglas
- * 
- */
-class NewAnnotatedParameter<X> extends AbstractNewAnnotatedElement implements AnnotatedParameter<X>
-{
-
-   private final int position;
-   private final AnnotatedCallable<X> declaringCallable;
-
-   NewAnnotatedParameter(AnnotatedCallable<X> declaringCallable, Class<?> type, int position, AnnotationStore annotations, Type genericType, Type typeOverride)
-   {
-      super(type, annotations, genericType, typeOverride);
-      this.declaringCallable = declaringCallable;
-      this.position = position;
-   }
-
-   public AnnotatedCallable<X> getDeclaringCallable()
-   {
-      return declaringCallable;
-   }
-
-   public int getPosition()
-   {
-      return position;
-   }
-
-}

Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedType.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedType.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedType.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -1,130 +0,0 @@
-/*
- * 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.extensions.util.annotated;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedType;
-
-/**
- * AnnotatedType implementation for adding beans in the BeforeBeanDiscovery
- * event
- * 
- * @author Stuart Douglas
- * 
- */
-class NewAnnotatedType<X> extends AbstractNewAnnotatedElement implements AnnotatedType<X>
-{
-
-   private final Set<AnnotatedConstructor<X>> constructors;
-   private final Set<AnnotatedField<? super X>> fields;
-   private final Set<AnnotatedMethod<? super X>> methods;
-
-   private final Class<X> javaClass;
-
-   /**
-    * We make sure that there is a NewAnnotatedMember for every public
-    * method/field/constructor
-    * 
-    * If annotation have been added to other methods as well we add them to
-    * 
-    */
-   NewAnnotatedType(Class<X> clazz, AnnotationStore typeAnnotations, Map<Field, AnnotationStore> fieldAnnotations, Map<Method, AnnotationStore> methodAnnotations, Map<Method, Map<Integer, AnnotationStore>> methodParameterAnnotations, Map<Constructor<X>, AnnotationStore> constructorAnnotations, Map<Constructor<X>, Map<Integer, AnnotationStore>> constructorParameterAnnotations, Map<Field, Type> fieldTypes, Map<Method, Map<Integer, Type>> methodParameterTypes, Map<Constructor<?>, Map<Integer, Type>> constructorParameterTypes)
-   {
-      super(clazz, typeAnnotations, null, null);
-      this.javaClass = clazz;
-      this.constructors = new HashSet<AnnotatedConstructor<X>>();
-      Set<Constructor<?>> cset = new HashSet<Constructor<?>>();
-      Set<Method> mset = new HashSet<Method>();
-      Set<Field> fset = new HashSet<Field>();
-      for (Constructor<?> c : clazz.getConstructors())
-      {
-         NewAnnotatedConstructor<X> nc = new NewAnnotatedConstructor<X>(this, c, constructorAnnotations.get(c), constructorParameterAnnotations.get(c), constructorParameterTypes.get(c));
-         constructors.add(nc);
-         cset.add(c);
-      }
-      for (Entry<Constructor<X>, AnnotationStore> c : constructorAnnotations.entrySet())
-      {
-         if (!cset.contains(c.getKey()))
-         {
-            NewAnnotatedConstructor<X> nc = new NewAnnotatedConstructor<X>(this, c.getKey(), c.getValue(), constructorParameterAnnotations.get(c.getKey()), constructorParameterTypes.get(c.getKey()));
-            constructors.add(nc);
-         }
-      }
-      this.methods = new HashSet<AnnotatedMethod<? super X>>();
-      for (Method m : clazz.getMethods())
-      {
-         NewAnnotatedMethod<X> met = new NewAnnotatedMethod<X>(this, m, methodAnnotations.get(m), methodParameterAnnotations.get(m), methodParameterTypes.get(m));
-         methods.add(met);
-         mset.add(m);
-      }
-      for (Entry<Method, AnnotationStore> c : methodAnnotations.entrySet())
-      {
-         if (!mset.contains(c.getKey()))
-         {
-            NewAnnotatedMethod<X> nc = new NewAnnotatedMethod<X>(this, c.getKey(), c.getValue(), methodParameterAnnotations.get(c.getKey()), methodParameterTypes.get(c.getKey()));
-            methods.add(nc);
-         }
-      }
-      this.fields = new HashSet<AnnotatedField<? super X>>();
-      for (Field f : clazz.getFields())
-      {
-         NewAnnotatedField<X> b = new NewAnnotatedField<X>(this, f, fieldAnnotations.get(f), fieldTypes.get(f));
-         fields.add(b);
-         fset.add(f);
-      }
-      for (Entry<Field, AnnotationStore> e : fieldAnnotations.entrySet())
-      {
-         if (!fset.contains(e.getKey()))
-         {
-            fields.add(new NewAnnotatedField<X>(this, e.getKey(), e.getValue(), fieldTypes.get(e.getKey())));
-         }
-      }
-   }
-
-   public Set<AnnotatedConstructor<X>> getConstructors()
-   {
-      return Collections.unmodifiableSet(constructors);
-   }
-
-   public Set<AnnotatedField<? super X>> getFields()
-   {
-      return Collections.unmodifiableSet(fields);
-   }
-
-   public Class<X> getJavaClass()
-   {
-      return javaClass;
-   }
-
-   public Set<AnnotatedMethod<? super X>> getMethods()
-   {
-      return Collections.unmodifiableSet(methods);
-   }
-
-}

Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedTypeBuilder.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedTypeBuilder.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedTypeBuilder.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -1,556 +0,0 @@
-/*
- * 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.extensions.util.annotated;
-
-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.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.enterprise.inject.spi.Annotated;
-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.extensions.util.ReflectionUtils;
-
-/**
- * Class for constructing a new AnnotatedType. A new instance of builder must be
- * used for each annotated type.
- * 
- * In can either be created with no annotations, or the annotations can be read
- * from the underlying class or an AnnotatedType
- * 
- * @author Stuart Douglas
- * @author Pete Muir
- * 
- */
-public class NewAnnotatedTypeBuilder<X>
-{
-   private Map<Field, AnnotationBuilder> fields = new HashMap<Field, AnnotationBuilder>();
-   private Map<Method, AnnotationBuilder> methods = new HashMap<Method, AnnotationBuilder>();
-   private Map<Method, Map<Integer, AnnotationBuilder>> methodParameters = new HashMap<Method, Map<Integer, AnnotationBuilder>>();
-   private Map<Constructor<X>, AnnotationBuilder> constructors = new HashMap<Constructor<X>, AnnotationBuilder>();
-   private Map<Constructor<X>, Map<Integer, AnnotationBuilder>> constructorParameters = new HashMap<Constructor<X>, Map<Integer, AnnotationBuilder>>();
-   private AnnotationBuilder typeAnnotations = new AnnotationBuilder();
-   private Class<X> underlying;
-
-   private Map<Field, Type> fieldTypes = new HashMap<Field, Type>();
-   private Map<Method, Map<Integer, Type>> methodParameterTypes = new HashMap<Method, Map<Integer, Type>>();
-   private Map<Constructor<?>, Map<Integer, Type>> constructorParameterTypes = new HashMap<Constructor<?>, Map<Integer, Type>>();
-
-   public static <X> NewAnnotatedTypeBuilder<X> newInstance(Class<X> underlying)
-   {
-      return new NewAnnotatedTypeBuilder<X>(underlying);
-   }
-
-   public static <X> NewAnnotatedTypeBuilder<X> newInstance(AnnotatedType<X> underlying)
-   {
-      return new NewAnnotatedTypeBuilder<X>(underlying);
-   }
-
-   protected NewAnnotatedTypeBuilder(Class<X> underlying)
-   {
-      this.underlying = underlying;
-   }
-
-   protected NewAnnotatedTypeBuilder(AnnotatedType<X> underlying)
-   {
-      this.underlying = underlying.getJavaClass();
-
-   }
-
-   public NewAnnotatedTypeBuilder<X> readAnnotationsFromUnderlying()
-   {
-      for (Annotation a : underlying.getAnnotations())
-      {
-         typeAnnotations.add(a);
-      }
-
-      for (Field f : ReflectionUtils.getFields(underlying))
-      {
-         AnnotationBuilder ab = new AnnotationBuilder();
-         fields.put(f, ab);
-         f.setAccessible(true);
-         for (Annotation a : f.getAnnotations())
-         {
-            ab.add(a);
-         }
-      }
-
-      for (Method m : ReflectionUtils.getMethods(underlying))
-      {
-         AnnotationBuilder ab = new AnnotationBuilder();
-         m.setAccessible(true);
-         methods.put(m, ab);
-         for (Annotation a : m.getAnnotations())
-         {
-            ab.add(a);
-         }
-         Map<Integer, AnnotationBuilder> mparams = new HashMap<Integer, AnnotationBuilder>();
-         methodParameters.put(m, mparams);
-         for (int i = 0; i < m.getParameterTypes().length; ++i)
-         {
-            AnnotationBuilder mab = new AnnotationBuilder();
-            mparams.put(i, mab);
-            for (Annotation a : m.getParameterAnnotations()[i])
-            {
-               mab.add(a);
-            }
-         }
-      }
-
-      for (Constructor m : underlying.getDeclaredConstructors())
-      {
-         AnnotationBuilder ab = new AnnotationBuilder();
-         m.setAccessible(true);
-         constructors.put(m, ab);
-         for (Annotation a : m.getAnnotations())
-         {
-            ab.add(a);
-         }
-         Map<Integer, AnnotationBuilder> mparams = new HashMap<Integer, AnnotationBuilder>();
-         constructorParameters.put(m, mparams);
-         for (int i = 0; i < m.getParameterTypes().length; ++i)
-         {
-            AnnotationBuilder mab = new AnnotationBuilder();
-            mparams.put(i, mab);
-            for (Annotation a : m.getParameterAnnotations()[i])
-            {
-               mab.add(a);
-            }
-         }
-      }
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> addToClass(Annotation a)
-   {
-      typeAnnotations.add(a);
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> removeFromClass(Class<? extends Annotation> annotation)
-   {
-      typeAnnotations.remove(annotation);
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> addToField(Field field, Annotation a)
-   {
-      AnnotationBuilder annotations = fields.get(field);
-      if (annotations == null)
-      {
-         annotations = new AnnotationBuilder();
-         fields.put(field, annotations);
-      }
-      annotations.add(a);
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> removeFromField(Field field, Class<? extends Annotation> a)
-   {
-      AnnotationBuilder annotations = fields.get(field);
-      if (annotations != null)
-      {
-         annotations.remove(a);
-      }
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> addToMethod(Method method, Annotation a)
-   {
-      AnnotationBuilder annotations = methods.get(method);
-      if (annotations == null)
-      {
-         annotations = new AnnotationBuilder();
-         methods.put(method, annotations);
-      }
-      annotations.add(a);
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> removeFromMethod(Method method, Class<? extends Annotation> a)
-   {
-      AnnotationBuilder annotations = methods.get(method);
-      if (annotations != null)
-      {
-         annotations.remove(a);
-      }
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> addToMethodParameter(Method method, int parameter, Annotation a)
-   {
-      if (!methods.containsKey(method))
-      {
-         methods.put(method, new AnnotationBuilder());
-      }
-      Map<Integer, AnnotationBuilder> anmap = methodParameters.get(method);
-      if (anmap == null)
-      {
-         anmap = new HashMap<Integer, AnnotationBuilder>();
-         methodParameters.put(method, anmap);
-      }
-      AnnotationBuilder annotations = anmap.get(parameter);
-      if (annotations == null)
-      {
-         annotations = new AnnotationBuilder();
-         anmap.put(parameter, annotations);
-      }
-      annotations.add(a);
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> removeFromMethodParameter(Method method, int parameter, Class<? extends Annotation> a)
-   {
-      Map<Integer, AnnotationBuilder> anmap = methodParameters.get(method);
-      if (anmap != null)
-      {
-         AnnotationBuilder annotations = anmap.get(parameter);
-         if (annotations != null)
-         {
-            annotations.remove(a);
-         }
-      }
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> addToConstructor(Constructor<X> constructor, Annotation a)
-   {
-      AnnotationBuilder annotations = constructors.get(constructor);
-      if (annotations == null)
-      {
-         annotations = new AnnotationBuilder();
-         constructors.put(constructor, annotations);
-      }
-      annotations.add(a);
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> removeFromConstructor(Constructor<?> constructor, Class<? extends Annotation> a)
-   {
-      AnnotationBuilder annotations = constructors.get(constructor);
-      if (annotations != null)
-      {
-         annotations.remove(a);
-      }
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> addToConstructorParameter(Constructor<X> constructor, int parameter, Annotation a)
-   {
-      if (!constructors.containsKey(constructor))
-      {
-         constructors.put(constructor, new AnnotationBuilder());
-      }
-      Map<Integer, AnnotationBuilder> anmap = constructorParameters.get(constructor);
-      if (anmap == null)
-      {
-         anmap = new HashMap<Integer, AnnotationBuilder>();
-         constructorParameters.put(constructor, anmap);
-      }
-      AnnotationBuilder annotations = anmap.get(parameter);
-      if (annotations == null)
-      {
-         annotations = new AnnotationBuilder();
-         anmap.put(parameter, annotations);
-      }
-      annotations.add(a);
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> removeFromConstructorParameter(Constructor<X> constructor, int parameter, Class<? extends Annotation> a)
-   {
-      Map<Integer, AnnotationBuilder> anmap = constructorParameters.get(constructor);
-      if (anmap != null)
-      {
-         AnnotationBuilder annotations = anmap.get(parameter);
-         if (annotations != null)
-         {
-            annotations.remove(a);
-         }
-      }
-      return this;
-   }
-
-   public NewAnnotatedTypeBuilder<X> removeFromAll(Class<? extends Annotation> a)
-   {
-      removeFromClass(a);
-      for (Entry<Field, AnnotationBuilder> e : fields.entrySet())
-      {
-         e.getValue().remove(a);
-      }
-      for (Entry<Method, AnnotationBuilder> e : methods.entrySet())
-      {
-         e.getValue().remove(a);
-         Map<Integer, AnnotationBuilder> params = methodParameters.get(e.getKey());
-         if (params != null)
-         {
-            for (Entry<Integer, AnnotationBuilder> p : params.entrySet())
-            {
-               p.getValue().remove(a);
-            }
-         }
-      }
-      for (Entry<Constructor<X>, AnnotationBuilder> e : constructors.entrySet())
-      {
-         e.getValue().remove(a);
-         Map<Integer, AnnotationBuilder> params = constructorParameters.get(e.getKey());
-         if (params != null)
-         {
-            for (Entry<Integer, AnnotationBuilder> p : params.entrySet())
-            {
-               p.getValue().remove(a);
-            }
-         }
-      }
-      return this;
-   }
-
-   public <T extends Annotation> NewAnnotatedTypeBuilder<X> redefineMemberParameters(Class<T> annotationType, ParameterAnnotationRedefiner<T> redefinition)
-   {
-      for (Entry<Method, AnnotationBuilder> e : methods.entrySet())
-      {
-         Map<Integer, AnnotationBuilder> params = methodParameters.get(e.getKey());
-         if (params != null)
-         {
-            for (Entry<Integer, AnnotationBuilder> p : params.entrySet())
-            {
-               redefineAnnotationBuilder(annotationType, redefinition, new Parameter(e.getKey(), p.getKey()), p.getValue());
-            }
-         }
-      }
-      for (Entry<Constructor<X>, AnnotationBuilder> e : constructors.entrySet())
-      {
-         Map<Integer, AnnotationBuilder> params = constructorParameters.get(e.getKey());
-         if (params != null)
-         {
-            for (Entry<Integer, AnnotationBuilder> p : params.entrySet())
-            {
-               redefineAnnotationBuilder(annotationType, redefinition, new Parameter(e.getKey(), p.getKey()), p.getValue());
-            }
-         }
-      }
-      return this;
-   }
-   
-   public <T extends Annotation> NewAnnotatedTypeBuilder<X> redefineMembers(Class<T> annotationType, MemberAnnotationRedefiner<T> redefinition)
-   {
-      for (Entry<Field, AnnotationBuilder> e : fields.entrySet())
-      {
-         redefineAnnotationBuilder(annotationType, redefinition, e.getKey(), e.getValue());
-      }
-      for (Entry<Method, AnnotationBuilder> e : methods.entrySet())
-      {
-         redefineAnnotationBuilder(annotationType, redefinition, e.getKey(), e.getValue());
-      }
-      for (Entry<Constructor<X>, AnnotationBuilder> e : constructors.entrySet())
-      {
-         redefineAnnotationBuilder(annotationType, redefinition, e.getKey(), e.getValue());
-      }
-      return this;
-   }
-
-   protected <T extends Annotation, A> void redefineAnnotationBuilder(Class<T> annotationType, AnnotationRedefiner<T, A> redefinition, A annotated, AnnotationBuilder builder)
-   {
-      T an = builder.getAnnotation(annotationType);
-      if (an != null)
-      {
-         builder.remove(annotationType);
-         T newAn = redefinition.redefine(an, annotated, builder);
-         if (newAn != null)
-         {
-            builder.add(newAn);
-         }
-      }
-   }
-
-   /**
-    * merges the annotations from an existing AnnotatedType. If they both have
-    * the same annotation on an element overwriteExisting determines which one
-    * to keep
-    * 
-    * @param type
-    * @param overwriteExisting
-    * @return
-    */
-   public NewAnnotatedTypeBuilder<X> mergeAnnotations(AnnotatedType<X> type, boolean overwriteExisting)
-   {
-      mergeAnnotationsOnElement(type, overwriteExisting, typeAnnotations);
-      for (AnnotatedField<? super X> field : type.getFields())
-      {
-         AnnotationBuilder ans = fields.get(field.getJavaMember());
-         if (ans == null)
-         {
-            ans = new AnnotationBuilder();
-            fields.put(field.getJavaMember(), ans);
-         }
-         mergeAnnotationsOnElement(field, overwriteExisting, ans);
-      }
-      for (AnnotatedMethod<? super X> method : type.getMethods())
-      {
-         AnnotationBuilder ans = methods.get(method.getJavaMember());
-         if (ans == null)
-         {
-            ans = new AnnotationBuilder();
-            methods.put(method.getJavaMember(), ans);
-         }
-         mergeAnnotationsOnElement(method, overwriteExisting, ans);
-         for (AnnotatedParameter<? super X> p : method.getParameters())
-         {
-            Map<Integer, AnnotationBuilder> params = methodParameters.get(method.getJavaMember());
-            if (params == null)
-            {
-               params = new HashMap<Integer, AnnotationBuilder>();
-               methodParameters.put(method.getJavaMember(), params);
-            }
-            AnnotationBuilder builder = params.get(p.getPosition());
-            if (builder == null)
-            {
-               builder = new AnnotationBuilder();
-               params.put(p.getPosition(), builder);
-            }
-            mergeAnnotationsOnElement(p, overwriteExisting, builder);
-         }
-      }
-      for (AnnotatedConstructor<? super X> constructor : type.getConstructors())
-      {
-         AnnotationBuilder ans = constructors.get(constructor.getJavaMember());
-         if (ans == null)
-         {
-            ans = new AnnotationBuilder();
-            constructors.put((Constructor) constructor.getJavaMember(), ans);
-         }
-         mergeAnnotationsOnElement(constructor, overwriteExisting, ans);
-         for (AnnotatedParameter<? super X> p : constructor.getParameters())
-         {
-            Map<Integer, AnnotationBuilder> params = constructorParameters.get(constructor.getJavaMember());
-            if (params == null)
-            {
-               params = new HashMap<Integer, AnnotationBuilder>();
-               constructorParameters.put((Constructor) constructor.getJavaMember(), params);
-            }
-            AnnotationBuilder builder = params.get(p.getPosition());
-            if (builder == null)
-            {
-               builder = new AnnotationBuilder();
-               params.put(p.getPosition(), builder);
-            }
-            mergeAnnotationsOnElement(p, overwriteExisting, builder);
-         }
-      }
-      return this;
-   }
-
-   protected void mergeAnnotationsOnElement(Annotated annotated, boolean overwriteExisting, AnnotationBuilder typeAnnotations)
-   {
-      for (Annotation a : annotated.getAnnotations())
-      {
-         if (typeAnnotations.getAnnotation(a.annotationType()) != null)
-         {
-            if (overwriteExisting)
-            {
-               typeAnnotations.remove(a.annotationType());
-               typeAnnotations.add(a);
-            }
-         }
-         else
-         {
-            typeAnnotations.add(a);
-         }
-      }
-   }
-
-   public AnnotatedType<X> create()
-   {
-      Map<Constructor<X>, Map<Integer, AnnotationStore>> constructorParameterAnnnotations = new HashMap<Constructor<X>, Map<Integer, AnnotationStore>>();
-      Map<Constructor<X>, AnnotationStore> constructorAnnotations = new HashMap<Constructor<X>, AnnotationStore>();
-      Map<Method, Map<Integer, AnnotationStore>> methodParameterAnnnotations = new HashMap<Method, Map<Integer, AnnotationStore>>();
-      Map<Method, AnnotationStore> methodAnnotations = new HashMap<Method, AnnotationStore>();
-      Map<Field, AnnotationStore> fieldAnnotations = new HashMap<Field, AnnotationStore>();
-
-      for (Entry<Field, AnnotationBuilder> e : fields.entrySet())
-      {
-         fieldAnnotations.put(e.getKey(), e.getValue().create());
-      }
-
-      for (Entry<Method, AnnotationBuilder> e : methods.entrySet())
-      {
-         methodAnnotations.put(e.getKey(), e.getValue().create());
-      }
-      for (Entry<Method, Map<Integer, AnnotationBuilder>> e : methodParameters.entrySet())
-      {
-         Map<Integer, AnnotationStore> parameterAnnotations = new HashMap<Integer, AnnotationStore>();
-         methodParameterAnnnotations.put(e.getKey(), parameterAnnotations);
-         for (Entry<Integer, AnnotationBuilder> pe : e.getValue().entrySet())
-         {
-            parameterAnnotations.put(pe.getKey(), pe.getValue().create());
-         }
-      }
-
-      for (Entry<Constructor<X>, AnnotationBuilder> e : constructors.entrySet())
-      {
-         constructorAnnotations.put(e.getKey(), e.getValue().create());
-      }
-      for (Entry<Constructor<X>, Map<Integer, AnnotationBuilder>> e : constructorParameters.entrySet())
-      {
-         Map<Integer, AnnotationStore> parameterAnnotations = new HashMap<Integer, AnnotationStore>();
-         constructorParameterAnnnotations.put(e.getKey(), parameterAnnotations);
-         for (Entry<Integer, AnnotationBuilder> pe : e.getValue().entrySet())
-         {
-            parameterAnnotations.put(pe.getKey(), pe.getValue().create());
-         }
-      }
-
-      return new NewAnnotatedType<X>(underlying, typeAnnotations.create(), fieldAnnotations, methodAnnotations, methodParameterAnnnotations, constructorAnnotations, constructorParameterAnnnotations, fieldTypes, methodParameterTypes, constructorParameterTypes);
-   }
-
-   public void overrideFieldType(Field field, Type type)
-   {
-      fieldTypes.put(field, type);
-   }
-
-   public void overrideMethodParameterType(Method method, Type type, int position)
-   {
-      Map<Integer, Type> t = methodParameterTypes.get(method);
-      if (t == null)
-      {
-         t = new HashMap<Integer, Type>();
-         methodParameterTypes.put(method, t);
-      }
-      t.put(position, type);
-   }
-
-   public void overrideConstructorParameterType(Constructor<?> constructor, Type type, int position)
-   {
-      Map<Integer, Type> t = constructorParameterTypes.get(constructor);
-      if (t == null)
-      {
-         t = new HashMap<Integer, Type>();
-         constructorParameterTypes.put(constructor, t);
-      }
-      t.put(position, type);
-   }
-
-}

Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/TypeClosureBuilder.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/TypeClosureBuilder.java	2010-04-29 20:22:21 UTC (rev 6199)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/annotated/TypeClosureBuilder.java	2010-04-29 21:36:09 UTC (rev 6200)
@@ -29,23 +29,25 @@
 class TypeClosureBuilder
 {
 
-   final Set<Type> types = new HashSet<Type>();
+   private final Set<Type> types;
+   
+   TypeClosureBuilder()
+   {
+      this.types = new HashSet<Type>();
+   }
 
-   public TypeClosureBuilder add(Type type)
+   TypeClosureBuilder add(Type type)
    {
       types.add(type);
       return this;
    }
 
-   public TypeClosureBuilder add(Class<?> beanType)
+   TypeClosureBuilder add(Class<?> beanType)
    {
-      Class<?> c = beanType;
-      do
+      for (Class<?> c = beanType; c != Object.class && c != null; c = c.getSuperclass())
       {
          types.add(c);
-         c = c.getSuperclass();
       }
-      while (c != null);
       for (Class<?> i : beanType.getInterfaces())
       {
          types.add(i);
@@ -53,7 +55,7 @@
       return this;
    }
 
-   public TypeClosureBuilder addInterfaces(Class<?> beanType)
+   TypeClosureBuilder addInterfaces(Class<?> beanType)
    {
       for (Class<?> i : beanType.getInterfaces())
       {
@@ -62,7 +64,7 @@
       return this;
    }
 
-   public Set<Type> getTypes()
+   Set<Type> getTypes()
    {
       return types;
    }



More information about the weld-commits mailing list