]> source.dussan.org Git - aspectj.git/commitdiff
tests and fix for pr119352
authoracolyer <acolyer>
Tue, 6 Dec 2005 15:39:08 +0000 (15:39 +0000)
committeracolyer <acolyer>
Tue, 6 Dec 2005 15:39:08 +0000 (15:39 +0000)
aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/AjTypeImpl.java
aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTests.java

index 8534d0743479ed01362ac3cd337674b0f8d85631..440a139e2ec711a71a88df84b040c614216bb7d5 100644 (file)
@@ -120,7 +120,7 @@ public class AjTypeImpl<T> implements AjType<T> {
         */
        public AjType<? super T> getSupertype() {
                Class<? super T> superclass = clazz.getSuperclass();
-               return (AjType<? super T>) new AjTypeImpl(superclass);
+               return superclass==null ? null : (AjType<? super T>) new AjTypeImpl(superclass);
        }
 
        /* (non-Javadoc)
index f634d6c73b20c8441562983c8324d6cd64575521..9416979de518ab5b9c959275aa694593fb32becf 100644 (file)
@@ -62,9 +62,19 @@ public class AjTypeTests extends TestCase {
        public void testGetSupertype() {
                Class<?> stringSuper = String.class.getSuperclass();
                AjType ajSuper = stringType.getSupertype();
-               assertEquals(AjTypeSystem.getAjType(stringSuper),ajSuper);
+               assertEquals(AjTypeSystem.getAjType(stringSuper),ajSuper);              
        }
 
+       public void testObjectSupertype() {
+               AjType<?> objectSuper = AjTypeSystem.getAjType(Object.class).getSupertype();
+               assertNull(objectSuper);                
+       }
+
+       public void testInterfaceSupertype() {
+               AjType<?> serializableSuper = AjTypeSystem.getAjType(Serializable.class).getSupertype();
+               assertNull(serializableSuper);          
+       }
+       
        public void testGetGenericSupertype() {
                Type t  = AjTypeSystem.getAjType(Goo.class).getGenericSupertype();
                assertEquals(Foo.class,t);