From 6e8bf5292686224d2110cbf8c2184e2568bcabe3 Mon Sep 17 00:00:00 2001 From: acolyer Date: Tue, 6 Dec 2005 15:39:08 +0000 Subject: [PATCH] tests and fix for pr119352 --- .../aspectj/internal/lang/reflect/AjTypeImpl.java | 2 +- .../aspectj/internal/lang/reflect/AjTypeTests.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/AjTypeImpl.java b/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/AjTypeImpl.java index 8534d0743..440a139e2 100644 --- a/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/AjTypeImpl.java +++ b/aspectj5rt/java5-src/org/aspectj/internal/lang/reflect/AjTypeImpl.java @@ -120,7 +120,7 @@ public class AjTypeImpl implements AjType { */ public AjType getSupertype() { Class superclass = clazz.getSuperclass(); - return (AjType) new AjTypeImpl(superclass); + return superclass==null ? null : (AjType) new AjTypeImpl(superclass); } /* (non-Javadoc) diff --git a/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTests.java b/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTests.java index f634d6c73..9416979de 100644 --- a/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTests.java +++ b/aspectj5rt/java5-testsrc/org/aspectj/internal/lang/reflect/AjTypeTests.java @@ -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); -- 2.39.5