aboutsummaryrefslogtreecommitdiffstats
path: root/weaver/testsrc/org
diff options
context:
space:
mode:
authoraclement <aclement>2005-11-28 15:52:50 +0000
committeraclement <aclement>2005-11-28 15:52:50 +0000
commit97b5f52b520f534ac712d1ce3cff7b6ed5cca14f (patch)
treebaf2baf03a91614aa20bc760bd54ecc0a05db633 /weaver/testsrc/org
parent340f99477cb028f696760f54ebaaf91f840d9eca (diff)
downloadaspectj-97b5f52b520f534ac712d1ce3cff7b6ed5cca14f.tar.gz
aspectj-97b5f52b520f534ac712d1ce3cff7b6ed5cca14f.zip
fixes for 118192
Diffstat (limited to 'weaver/testsrc/org')
-rw-r--r--weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java88
1 files changed, 86 insertions, 2 deletions
diff --git a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java b/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java
index 26c34db9e..2a86a1c47 100644
--- a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java
+++ b/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java
@@ -14,17 +14,17 @@ package org.aspectj.weaver.reflect;
import junit.framework.TestCase;
+import org.aspectj.weaver.ReferenceType;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.bcel.BcelWorld;
public class ReflectionBasedReferenceTypeDelegateTest extends TestCase {
protected ReflectionWorld world;
private ResolvedType objectType;
private ResolvedType classType;
- private ResolvedType enumType;
-
public void testIsAspect() {
assertFalse(objectType.isAspect());
@@ -173,6 +173,90 @@ public class ReflectionBasedReferenceTypeDelegateTest extends TestCase {
assertEquals(0,pointcuts.length);
}
+
+
+ public void testSerializableSuperclass() {
+ ResolvedType serializableType = world.resolve("java.io.Serializable");
+ ResolvedType superType = serializableType.getSuperclass();
+ assertTrue("Superclass of serializable should be Object but was "+superType,superType.equals(UnresolvedType.OBJECT));
+
+ BcelWorld bcelworld = new BcelWorld();
+ bcelworld.setBehaveInJava5Way(true);
+ ResolvedType bcelSupertype = bcelworld.resolve(UnresolvedType.SERIALIZABLE).getSuperclass();
+ assertTrue("Should be null but is "+bcelSupertype,bcelSupertype.equals(UnresolvedType.OBJECT));
+ }
+
+ public void testSubinterfaceSuperclass() {
+ ResolvedType ifaceType = world.resolve("java.security.Key");
+ ResolvedType superType = ifaceType.getSuperclass();
+ assertTrue("Superclass should be Object but was "+superType,superType.equals(UnresolvedType.OBJECT));
+
+ BcelWorld bcelworld = new BcelWorld();
+ bcelworld.setBehaveInJava5Way(true);
+ ResolvedType bcelSupertype = bcelworld.resolve("java.security.Key").getSuperclass();
+ assertTrue("Should be null but is "+bcelSupertype,bcelSupertype.equals(UnresolvedType.OBJECT));
+ }
+
+ public void testVoidSuperclass() {
+ ResolvedType voidType = world.resolve(Void.TYPE);
+ ResolvedType superType = voidType.getSuperclass();
+ assertNull(superType);
+
+ BcelWorld bcelworld = new BcelWorld();
+ bcelworld.setBehaveInJava5Way(true);
+ ResolvedType bcelSupertype = bcelworld.resolve("void").getSuperclass();
+ assertTrue("Should be null but is "+bcelSupertype,bcelSupertype==null);
+ }
+
+ public void testIntSuperclass() {
+ ResolvedType voidType = world.resolve(Integer.TYPE);
+ ResolvedType superType = voidType.getSuperclass();
+ assertNull(superType);
+
+ BcelWorld bcelworld = new BcelWorld();
+ bcelworld.setBehaveInJava5Way(true);
+ ResolvedType bcelSupertype = bcelworld.resolve("int").getSuperclass();
+ assertTrue("Should be null but is "+bcelSupertype,bcelSupertype==null);
+ }
+
+ public void testGenericInterfaceSuperclass_BcelWorldResolution() {
+ BcelWorld bcelworld = new BcelWorld();
+ bcelworld.setBehaveInJava5Way(true);
+
+ UnresolvedType javaUtilMap = UnresolvedType.forName("java.util.Map");
+
+ ReferenceType rawType = (ReferenceType) bcelworld.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));
+ }
+
+ 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 {
world = new ReflectionWorld();
objectType = world.resolve("java.lang.Object");