Author: swd847
Date: 2010-03-06 01:25:30 -0500 (Sat, 06 Mar 2010)
New Revision: 6012
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedCallable.java
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedElement.java
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedMember.java
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedConstructor.java
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedField.java
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedMethod.java
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedParameter.java
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedType.java
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/TypeClosureBuilder.java
Log:
NewAnnotated* now handles paramtised fields/methods properly
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedCallable.java
===================================================================
---
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedCallable.java 2010-03-05
21:42:52 UTC (rev 6011)
+++
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedCallable.java 2010-03-06
06:25:30 UTC (rev 6012)
@@ -1,6 +1,7 @@
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;
@@ -20,9 +21,9 @@
private final List<AnnotatedParameter<X>> parameters;
- protected AbstractNewAnnotatedCallable(AnnotatedType<X> declaringType, Y member,
Class<?> memberType, Class<?>[] parameterTypes, AnnotationStore annotations,
Map<Integer, AnnotationStore> parameterAnnotations)
+ protected AbstractNewAnnotatedCallable(AnnotatedType<X> declaringType, Y member,
Class<?> memberType, Class<?>[] parameterTypes, AnnotationStore annotations,
Map<Integer, AnnotationStore> parameterAnnotations, Type genericType)
{
- super(declaringType, member, memberType, annotations);
+ super(declaringType, member, memberType, annotations, genericType);
this.parameters = getAnnotatedParameters(this, parameterTypes,
parameterAnnotations);
}
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedElement.java
===================================================================
---
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedElement.java 2010-03-05
21:42:52 UTC (rev 6011)
+++
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedElement.java 2010-03-06
06:25:30 UTC (rev 6012)
@@ -16,13 +16,22 @@
abstract class AbstractNewAnnotatedElement implements Annotated
{
- private final Class<?> type;
+ private final Type type;
private final Set<Type> typeClosure;
private final AnnotationStore annotations;
- protected AbstractNewAnnotatedElement(Class<?> type, AnnotationStore
annotations)
+ protected AbstractNewAnnotatedElement(Class<?> type, AnnotationStore
annotations, Type genericType)
{
this.typeClosure = new TypeClosureBuilder().add(type).getTypes();
+ if (genericType != null)
+ {
+ typeClosure.add(genericType);
+ this.type = genericType;
+ }
+ else
+ {
+ this.type = type;
+ }
if (annotations == null)
{
this.annotations = new AnnotationStore();
@@ -31,7 +40,6 @@
{
this.annotations = annotations;
}
- this.type = type;
}
public <T extends Annotation> T getAnnotation(Class<T> annotationType)
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedMember.java
===================================================================
---
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedMember.java 2010-03-05
21:42:52 UTC (rev 6011)
+++
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/AbstractNewAnnotatedMember.java 2010-03-06
06:25:30 UTC (rev 6012)
@@ -2,6 +2,7 @@
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;
@@ -16,9 +17,9 @@
private final AnnotatedType<X> declaringType;
private final M javaMember;
- protected AbstractNewAnnotatedMember(AnnotatedType<X> declaringType, M member,
Class<?> memberType, AnnotationStore annotations)
+ protected AbstractNewAnnotatedMember(AnnotatedType<X> declaringType, M member,
Class<?> memberType, AnnotationStore annotations, Type genericType)
{
- super(memberType, annotations);
+ super(memberType, annotations, genericType);
this.declaringType = declaringType;
this.javaMember = member;
}
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedConstructor.java
===================================================================
---
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedConstructor.java 2010-03-05
21:42:52 UTC (rev 6011)
+++
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedConstructor.java 2010-03-06
06:25:30 UTC (rev 6012)
@@ -15,7 +15,7 @@
NewAnnotatedConstructor(NewAnnotatedType<X> type, Constructor<?>
constructor, AnnotationStore annotations, Map<Integer, AnnotationStore>
parameterAnnotations)
{
- super(type, (Constructor<X>) constructor, constructor.getDeclaringClass(),
constructor.getParameterTypes(), annotations, parameterAnnotations);
+ super(type, (Constructor<X>) constructor, constructor.getDeclaringClass(),
constructor.getParameterTypes(), annotations, parameterAnnotations, null);
}
}
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedField.java
===================================================================
---
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedField.java 2010-03-05
21:42:52 UTC (rev 6011)
+++
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedField.java 2010-03-06
06:25:30 UTC (rev 6012)
@@ -15,7 +15,7 @@
NewAnnotatedField(AnnotatedType<X> declaringType, Field field, AnnotationStore
annotations)
{
- super(declaringType, field, field.getType(), annotations);
+ super(declaringType, field, field.getType(), annotations, field.getGenericType());
}
}
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedMethod.java
===================================================================
---
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedMethod.java 2010-03-05
21:42:52 UTC (rev 6011)
+++
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedMethod.java 2010-03-06
06:25:30 UTC (rev 6012)
@@ -15,7 +15,7 @@
{
NewAnnotatedMethod(AnnotatedType<X> type, Method method, AnnotationStore
annotations, Map<Integer, AnnotationStore> parameterAnnotations)
{
- super(type, method, method.getReturnType(), method.getParameterTypes(),
annotations, parameterAnnotations);
+ super(type, method, method.getReturnType(), method.getParameterTypes(),
annotations, parameterAnnotations, method.getGenericReturnType());
}
}
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedParameter.java
===================================================================
---
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedParameter.java 2010-03-05
21:42:52 UTC (rev 6011)
+++
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedParameter.java 2010-03-06
06:25:30 UTC (rev 6012)
@@ -16,7 +16,7 @@
NewAnnotatedParameter(AnnotatedCallable<X> declaringCallable, Class<?>
type, int position, AnnotationStore annotations)
{
- super(type, annotations);
+ super(type, annotations, null);
this.declaringCallable = declaringCallable;
this.position = position;
}
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedType.java
===================================================================
---
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedType.java 2010-03-05
21:42:52 UTC (rev 6011)
+++
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/NewAnnotatedType.java 2010-03-06
06:25:30 UTC (rev 6012)
@@ -39,7 +39,7 @@
*/
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)
{
- super(clazz, typeAnnotations);
+ super(clazz, typeAnnotations, null);
this.javaClass = clazz;
this.constructors = new HashSet<AnnotatedConstructor<X>>();
Set<Constructor<?>> cset = new HashSet<Constructor<?>>();
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/TypeClosureBuilder.java
===================================================================
---
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/TypeClosureBuilder.java 2010-03-05
21:42:52 UTC (rev 6011)
+++
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/annotated/TypeClosureBuilder.java 2010-03-06
06:25:30 UTC (rev 6012)
@@ -15,6 +15,12 @@
final Set<Type> types = new HashSet<Type>();
+ public TypeClosureBuilder add(Type type)
+ {
+ types.add(type);
+ return this;
+ }
+
public TypeClosureBuilder add(Class<?> beanType)
{
Class<?> c = beanType;