Skip to content

Commit

Permalink
WBRI-369
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@3549 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Aug 18, 2009
1 parent 5075948 commit e8e70ae
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Expand Up @@ -19,6 +19,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
Expand Down Expand Up @@ -201,7 +202,7 @@ protected WBClassImpl(Class<T> rawType, Type type, AnnotationStore annotationSto
{
field.setAccessible(true);
}
WBField<?, ?> annotatedField = WBFieldImpl.of(field, this, classTransformer);
WBField<?, ?> annotatedField = WBFieldImpl.of(field, getDeclaringWBClass(field, classTransformer), classTransformer);
this.fields.add(annotatedField);
if (c == rawType)
{
Expand Down Expand Up @@ -249,11 +250,10 @@ public Set<WBConstructor<?>> get()

});
this.declaredConstructorsBySignature = new HashMap<ConstructorSignature, WBConstructor<?>>();
for (Constructor<?> constructor : rawType.getDeclaredConstructors())
for (Constructor<Object> constructor : rawType.getDeclaredConstructors())
{
@SuppressWarnings("unchecked")
Constructor<T> c = (Constructor<T>) constructor;
WBConstructor<T> annotatedConstructor = WBConstructorImpl.of(c, this, classTransformer);
// TODO Fix this cast
WBConstructor<T> annotatedConstructor = (WBConstructor<T>) WBConstructorImpl.of(constructor, getDeclaringWBClass(constructor, classTransformer), classTransformer);
if (!constructor.isAccessible())
{
constructor.setAccessible(true);
Expand Down Expand Up @@ -330,7 +330,7 @@ public Set<WBConstructor<?>> get()
method.setAccessible(true);
}

WBMethod<?, ?> annotatedMethod = WBMethodImpl.of(method, this, classTransformer);
WBMethod<?, ?> annotatedMethod = WBMethodImpl.of(method, getDeclaringWBClass(method, classTransformer), classTransformer);
this.methods.add(annotatedMethod);
this.methodsBySignature.put(annotatedMethod.getSignature(), annotatedMethod);
if (c == rawType)
Expand Down Expand Up @@ -360,6 +360,20 @@ public Set<WBConstructor<?>> get()
}
}
}

@SuppressWarnings("unchecked")
private <X> WBClass<X> getDeclaringWBClass(Member member, ClassTransformer transformer)
{
if (member.getDeclaringClass().equals(getJavaClass()))
{
return (WBClass<X>) this;
}
else
{
WBClass<X> loadClass = transformer.loadClass(member.getDeclaringClass());
return loadClass;
}
}

/**
* Gets the implementing class
Expand Down
Expand Up @@ -33,7 +33,7 @@
public class DeclaringTypeTest extends AbstractWebBeansTest
{

@Test(groups="broken")
@Test
public void testInheritance()
{
AnnotatedType<Child> type = getCurrentManager().createAnnotatedType(Child.class);
Expand Down

0 comments on commit e8e70ae

Please sign in to comment.