]> source.dussan.org Git - aspectj.git/commitdiff
Further changes for 118192
authoraclement <aclement>
Mon, 28 Nov 2005 17:44:35 +0000 (17:44 +0000)
committeraclement <aclement>
Mon, 28 Nov 2005 17:44:35 +0000 (17:44 +0000)
weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java
weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java
weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java

index 2dd8a3d41b4184dbc17a705edfaa014ef9d87cc0..ef61c7f2fa0738588fa986d9148898ced2041cb0 100644 (file)
@@ -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);
        }
index 2a86a1c47212ff1b223392cf3089b13b1bfdd50c..cc0407c5c52519cfd809d89929a99c27ec885f0c 100644 (file)
@@ -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 {
index a91e674bc4b4a093734ddcfa1b4302e6667fb06f..530dd984455ad26efec0aef7a4e6660a1a8603ac 100644 (file)
@@ -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));       
+    }
        
 }