From: aclement Date: Mon, 28 Nov 2005 17:44:35 +0000 (+0000) Subject: Further changes for 118192 X-Git-Tag: V1_5_0RC1~91 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b6980f2f7b2697e41b454a16d3a7bd1e0135aa8d;p=aspectj.git Further changes for 118192 --- diff --git a/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java b/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java index 2dd8a3d41..ef61c7f2f 100644 --- a/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java +++ b/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java @@ -297,7 +297,12 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega * @see org.aspectj.weaver.ReferenceTypeDelegate#getSuperclass() */ public ResolvedType getSuperclass() { - if (this.myClass.getSuperclass() == null) return null; + if (this.myClass.getSuperclass() == null) { + if (myClass==Object.class) { + return null; + } + return world.resolve(UnresolvedType.OBJECT); + } return ReflectionBasedReferenceTypeDelegateFactory .resolveTypeInWorld(this.myClass.getSuperclass(),world); } diff --git a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java b/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java index 2a86a1c47..cc0407c5c 100644 --- a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java +++ b/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java @@ -238,23 +238,6 @@ public class ReflectionBasedReferenceTypeDelegateTest extends TestCase { assertTrue("Superclass for Map generic type should be Object but was "+rt2,rt2.equals(UnresolvedType.OBJECT)); } - public void testGenericInterfaceSuperclass_ReflectionWorldResolution() { - - UnresolvedType javaUtilMap = UnresolvedType.forName("java.util.Map"); - - ReferenceType rawType = (ReferenceType) world.resolve(javaUtilMap); - assertTrue("Should be the raw type ?!? "+rawType.getTypekind(),rawType.isRawType()); - - ReferenceType genericType = (ReferenceType)rawType.getGenericType(); - assertTrue("Should be the generic type ?!? "+genericType.getTypekind(),genericType.isGenericType()); - - ResolvedType rt = rawType.getSuperclass(); - assertTrue("Superclass for Map raw type should be Object but was "+rt,rt.equals(UnresolvedType.OBJECT)); - - ResolvedType rt2 = genericType.getSuperclass(); - assertTrue("Superclass for Map generic type should be Object but was "+rt2,rt2.equals(UnresolvedType.OBJECT)); - } - // todo: array of int protected void setUp() throws Exception { diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java b/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java index a91e674bc..530dd9844 100644 --- a/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java +++ b/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java @@ -44,5 +44,21 @@ public class TestJava5ReflectionBasedReferenceTypeDelegate extends ReflectionBas world.resolve("java.lang.Class").getGenericType(); } + public void testGenericInterfaceSuperclass_ReflectionWorldResolution() { + + UnresolvedType javaUtilMap = UnresolvedType.forName("java.util.Map"); + + ReferenceType rawType = (ReferenceType) world.resolve(javaUtilMap); + assertTrue("Should be the raw type ?!? "+rawType.getTypekind(),rawType.isRawType()); + + ReferenceType genericType = (ReferenceType)rawType.getGenericType(); + assertTrue("Should be the generic type ?!? "+genericType.getTypekind(),genericType.isGenericType()); + + ResolvedType rt = rawType.getSuperclass(); + assertTrue("Superclass for Map raw type should be Object but was "+rt,rt.equals(UnresolvedType.OBJECT)); + + ResolvedType rt2 = genericType.getSuperclass(); + assertTrue("Superclass for Map generic type should be Object but was "+rt2,rt2.equals(UnresolvedType.OBJECT)); + } }