diff options
author | aclement <aclement> | 2011-08-12 17:53:24 +0000 |
---|---|---|
committer | aclement <aclement> | 2011-08-12 17:53:24 +0000 |
commit | 43c230b3c87108e131b9e49cb2e66b3ccc1b5d27 (patch) | |
tree | 1ed6cc53cd29030da558a4649a17a02214716c28 /weaver5 | |
parent | eb5a3b19f342142e1ee5d5543de59b273fa17de5 (diff) | |
download | aspectj-43c230b3c87108e131b9e49cb2e66b3ccc1b5d27.tar.gz aspectj-43c230b3c87108e131b9e49cb2e66b3ccc1b5d27.zip |
239649 and primitives no longer all resolved by default
Diffstat (limited to 'weaver5')
4 files changed, 178 insertions, 181 deletions
diff --git a/weaver5/java5-src/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java b/weaver5/java5-src/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java index e91f9f346..b0af93f16 100644 --- a/weaver5/java5-src/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java +++ b/weaver5/java5-src/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java @@ -13,29 +13,23 @@ package org.aspectj.weaver.reflect; import org.aspectj.weaver.ResolvedPointcutDefinition; -import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; /** - * When a Java15ReflectionBasedDelegate gets the pointcuts for a given class it - * tries to resolve them before returning. - * This can cause problems if the resolution of one pointcut in the type depends - * on another pointcut in the same type. - * Therefore the algorithm proceeds in two phases, first we create and store - * instances of this class in the pointcuts array, and once that is done, we - * come back round and resolve the actual pointcut expression. This means that - * if we recurse doing resolution, we will find the named pointcut we are - * looking for! + * When a Java15ReflectionBasedDelegate gets the pointcuts for a given class it tries to resolve them before returning. This can + * cause problems if the resolution of one pointcut in the type depends on another pointcut in the same type. Therefore the + * algorithm proceeds in two phases, first we create and store instances of this class in the pointcuts array, and once that is + * done, we come back round and resolve the actual pointcut expression. This means that if we recurse doing resolution, we will find + * the named pointcut we are looking for! * * @author adrian colyer - * + * */ public class DeferredResolvedPointcutDefinition extends ResolvedPointcutDefinition { - public DeferredResolvedPointcutDefinition(UnresolvedType declaringType, - int modifiers, String name, UnresolvedType[] parameterTypes) { - super(declaringType, modifiers, name, parameterTypes, - ResolvedType.VOID, null); + public DeferredResolvedPointcutDefinition(UnresolvedType declaringType, int modifiers, String name, + UnresolvedType[] parameterTypes) { + super(declaringType, modifiers, name, parameterTypes, UnresolvedType.VOID, null); } - + } diff --git a/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java b/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java index 8ddfbe803..695dd7567 100644 --- a/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java +++ b/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java @@ -218,8 +218,8 @@ public class Java15ReflectionBasedReferenceTypeDelegate extends ReflectionBasedR private ResolvedMember createGenericMethodMember(Method forMethod) { ReflectionBasedResolvedMemberImpl ret = new ReflectionBasedResolvedMemberImpl(org.aspectj.weaver.Member.METHOD, - getGenericResolvedType(), forMethod.getModifiers(), typeConverter.fromType(forMethod.getReturnType()), forMethod - .getName(), typeConverter.fromTypes(forMethod.getParameterTypes()), typeConverter.fromTypes(forMethod + getGenericResolvedType(), forMethod.getModifiers(), typeConverter.fromType(forMethod.getReturnType()), + forMethod.getName(), typeConverter.fromTypes(forMethod.getParameterTypes()), typeConverter.fromTypes(forMethod .getExceptionTypes()), forMethod); ret.setAnnotationFinder(this.annotationFinder); ret.setGenericSignatureInformationProvider(new Java15GenericSignatureInformationProvider(this.getWorld())); @@ -230,7 +230,7 @@ public class Java15ReflectionBasedReferenceTypeDelegate extends ReflectionBasedR ReflectionBasedResolvedMemberImpl ret = new ReflectionBasedResolvedMemberImpl(org.aspectj.weaver.Member.METHOD, getGenericResolvedType(), forConstructor.getModifiers(), // to return what BCEL returns the return type is void - ResolvedType.VOID,// getGenericResolvedType(), + UnresolvedType.VOID,// getGenericResolvedType(), "<init>", typeConverter.fromTypes(forConstructor.getParameterTypes()), typeConverter.fromTypes(forConstructor .getExceptionTypes()), forConstructor); ret.setAnnotationFinder(this.annotationFinder); diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java b/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java index 4d92b1d6f..72c7c85f7 100644 --- a/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java +++ b/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java @@ -11,7 +11,6 @@ * ******************************************************************/ package org.aspectj.weaver.reflect; - import java.lang.reflect.Method; import java.util.HashSet; import java.util.Set; @@ -30,187 +29,185 @@ public abstract class ReflectionBasedReferenceTypeDelegateTest extends TestCase protected ReflectionWorld world; private ResolvedType objectType; private ResolvedType classType; - + public void testIsAspect() { assertFalse(objectType.isAspect()); } - + public void testIsAnnotationStyleAspect() { assertFalse(objectType.isAnnotationStyleAspect()); } - + public void testIsInterface() { assertFalse(objectType.isInterface()); assertTrue(world.resolve("java.io.Serializable").isInterface()); } - + public void testIsEnum() { assertFalse(objectType.isEnum()); } - + public void testIsAnnotation() { assertFalse(objectType.isAnnotation()); } - + public void testIsAnnotationWithRuntimeRetention() { assertFalse(objectType.isAnnotationWithRuntimeRetention()); } - + public void testIsClass() { assertTrue(objectType.isClass()); assertFalse(world.resolve("java.io.Serializable").isClass()); } - + public void testIsGeneric() { assertFalse(objectType.isGenericType()); } - + public void testIsExposedToWeaver() { assertFalse(objectType.isExposedToWeaver()); } - + public void testHasAnnotation() { assertFalse(objectType.hasAnnotation(UnresolvedType.forName("Foo"))); } - + public void testGetAnnotations() { - assertEquals("no entries",0,objectType.getAnnotations().length); + assertEquals("no entries", 0, objectType.getAnnotations().length); } - + public void testGetAnnotationTypes() { - assertEquals("no entries",0,objectType.getAnnotationTypes().length); + assertEquals("no entries", 0, objectType.getAnnotationTypes().length); } - + public void testGetTypeVariables() { - assertEquals("no entries",0,objectType.getTypeVariables().length); + assertEquals("no entries", 0, objectType.getTypeVariables().length); } - + public void testGetPerClause() { assertNull(objectType.getPerClause()); } - + public void testGetModifiers() { - assertEquals(Object.class.getModifiers(),objectType.getModifiers()); + assertEquals(Object.class.getModifiers(), objectType.getModifiers()); } - + public void testGetSuperclass() { - assertTrue("Superclass of object should be null, but it is: "+objectType.getSuperclass(),objectType.getSuperclass()==null); - assertEquals(objectType,world.resolve("java.lang.Class").getSuperclass()); + assertTrue("Superclass of object should be null, but it is: " + objectType.getSuperclass(), + objectType.getSuperclass() == null); + assertEquals(objectType, world.resolve("java.lang.Class").getSuperclass()); ResolvedType d = world.resolve("reflect.tests.D"); - assertEquals(world.resolve("reflect.tests.C"),d.getSuperclass()); + assertEquals(world.resolve("reflect.tests.C"), d.getSuperclass()); } - protected int findMethod(String name, ResolvedMember[] methods) { - for (int i=0; i<methods.length; i++) { + for (int i = 0; i < methods.length; i++) { if (name.equals(methods[i].getName())) { return i; } } return -1; } - + protected int findMethod(String name, int numArgs, ResolvedMember[] methods) { - for (int i=0; i<methods.length; i++) { + for (int i = 0; i < methods.length; i++) { if (name.equals(methods[i].getName()) && (methods[i].getParameterTypes().length == numArgs)) { return i; } } return -1; } - + public void testGetDeclaredMethods() { ResolvedMember[] methods = objectType.getDeclaredMethods(); assertEquals(Object.class.getDeclaredMethods().length + Object.class.getDeclaredConstructors().length, methods.length); - + ResolvedType c = world.resolve("reflect.tests.C"); methods = c.getDeclaredMethods(); - assertEquals(3,methods.length); + assertEquals(3, methods.length); int idx = findMethod("foo", methods); assertTrue(idx > -1); - - assertEquals(world.resolve("java.lang.String"),methods[idx].getReturnType()); + + assertEquals(world.resolve("java.lang.String"), methods[idx].getReturnType()); assertEquals(1, methods[idx].getParameterTypes().length); - assertEquals(objectType,methods[idx].getParameterTypes()[0]); - assertEquals(1,methods[idx].getExceptions().length); - assertEquals(world.resolve("java.lang.Exception"),methods[idx].getExceptions()[0]); + assertEquals(objectType, methods[idx].getParameterTypes()[0]); + assertEquals(1, methods[idx].getExceptions().length); + assertEquals(world.resolve("java.lang.Exception"), methods[idx].getExceptions()[0]); int baridx = findMethod("bar", methods); int initidx = findMethod("<init>", methods); assertTrue(baridx > -1); assertTrue(initidx > -1); assertTrue(baridx != initidx && baridx != idx && idx <= 2 && initidx <= 2 && baridx <= 2); - + ResolvedType d = world.resolve("reflect.tests.D"); methods = d.getDeclaredMethods(); - assertEquals(2,methods.length); + assertEquals(2, methods.length); classType = world.resolve("java.lang.Class"); methods = classType.getDeclaredMethods(); - assertEquals(Class.class.getDeclaredMethods().length + Class.class.getDeclaredConstructors().length, methods.length); + assertEquals(Class.class.getDeclaredMethods().length + Class.class.getDeclaredConstructors().length, methods.length); } - + public void testGetDeclaredFields() { ResolvedMember[] fields = objectType.getDeclaredFields(); - assertEquals(0,fields.length); + assertEquals(0, fields.length); ResolvedType c = world.resolve("reflect.tests.C"); fields = c.getDeclaredFields(); - - assertEquals(2,fields.length); - assertEquals("f",fields[0].getName()); - assertEquals("s",fields[1].getName()); - assertEquals(ResolvedType.INT,fields[0].getReturnType()); - assertEquals(world.resolve("java.lang.String"),fields[1].getReturnType()); + + assertEquals(2, fields.length); + assertEquals("f", fields[0].getName()); + assertEquals("s", fields[1].getName()); + assertEquals(UnresolvedType.INT, fields[0].getReturnType()); + assertEquals(world.resolve("java.lang.String"), fields[1].getReturnType()); } - + public void testGetDeclaredInterfaces() { ResolvedType[] interfaces = objectType.getDeclaredInterfaces(); - assertEquals(0,interfaces.length); + assertEquals(0, interfaces.length); ResolvedType d = world.resolve("reflect.tests.D"); interfaces = d.getDeclaredInterfaces(); - assertEquals(1,interfaces.length); - assertEquals(world.resolve("java.io.Serializable"),interfaces[0]); - } - + assertEquals(1, interfaces.length); + assertEquals(world.resolve("java.io.Serializable"), interfaces[0]); + } + public void testGetDeclaredPointcuts() { ResolvedMember[] pointcuts = objectType.getDeclaredPointcuts(); - assertEquals(0,pointcuts.length); + 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)); + 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)); + 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() { + + 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)); + 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)); + 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); + + 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() { @@ -218,94 +215,99 @@ public abstract class ReflectionBasedReferenceTypeDelegateTest extends TestCase 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); + 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)); - } - - // FIXME asc maybe. The reflection list of methods returned doesn't include <clinit> (the static initializer) ... is that really a problem. - public void testCompareSubclassDelegates() { - - boolean barfIfClinitMissing = false; - world.setBehaveInJava5Way(true); - - BcelWorld bcelWorld = new BcelWorld(getClass().getClassLoader(),IMessageHandler.THROW,null); - bcelWorld.setBehaveInJava5Way(true); - UnresolvedType javaUtilHashMap = UnresolvedType.forName("java.util.HashMap"); - ReferenceType rawType =(ReferenceType)bcelWorld.resolve(javaUtilHashMap ); - - ReferenceType rawReflectType =(ReferenceType)world.resolve(javaUtilHashMap ); - ResolvedMember[] rms1 = rawType.getDelegate().getDeclaredMethods(); - ResolvedMember[] rms2 = rawReflectType.getDelegate().getDeclaredMethods(); - StringBuffer errors = new StringBuffer(); - Set one = new HashSet(); - for (int i = 0; i < rms1.length; i++) { + + 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)); + } + + // FIXME asc maybe. The reflection list of methods returned doesn't include <clinit> (the static initializer) ... is that really + // a problem. + public void testCompareSubclassDelegates() { + + boolean barfIfClinitMissing = false; + world.setBehaveInJava5Way(true); + + BcelWorld bcelWorld = new BcelWorld(getClass().getClassLoader(), IMessageHandler.THROW, null); + bcelWorld.setBehaveInJava5Way(true); + UnresolvedType javaUtilHashMap = UnresolvedType.forName("java.util.HashMap"); + ReferenceType rawType = (ReferenceType) bcelWorld.resolve(javaUtilHashMap); + + ReferenceType rawReflectType = (ReferenceType) world.resolve(javaUtilHashMap); + ResolvedMember[] rms1 = rawType.getDelegate().getDeclaredMethods(); + ResolvedMember[] rms2 = rawReflectType.getDelegate().getDeclaredMethods(); + StringBuffer errors = new StringBuffer(); + Set one = new HashSet(); + for (int i = 0; i < rms1.length; i++) { one.add(rms1[i].toString()); } - Set two = new HashSet(); - for (int i = 0; i < rms2.length; i++) { + Set two = new HashSet(); + for (int i = 0; i < rms2.length; i++) { two.add(rms2[i].toString()); } - for (int i = 0;i<rms2.length;i++) { - if (!one.contains(rms2[i].toString())) { - errors.append("Couldn't find "+rms2[i].toString()+" in the bcel set\n"); - } - } - for (int i = 0;i<rms1.length;i++) { - if (!two.contains(rms1[i].toString())) { - if (!barfIfClinitMissing && rms1[i].getName().equals("<clinit>")) continue; - errors.append("Couldn't find "+rms1[i].toString()+" in the reflection set\n"); - } - } - assertTrue("Errors:"+errors.toString(),errors.length()==0); - - // the good old ibm vm seems to offer clinit through its reflection support (see pr145322) - if (rms1.length==rms2.length) return; - if (barfIfClinitMissing) { - // the numbers must be exact - assertEquals(rms1.length,rms2.length); - } else { - // the numbers can be out by one in favour of bcel - if (rms1.length!=(rms2.length+1)) { - for (int i = 0; i < rms1.length; i++) { - System.err.println("bcel"+i+" is "+rms1[i]); + for (int i = 0; i < rms2.length; i++) { + if (!one.contains(rms2[i].toString())) { + errors.append("Couldn't find " + rms2[i].toString() + " in the bcel set\n"); + } + } + for (int i = 0; i < rms1.length; i++) { + if (!two.contains(rms1[i].toString())) { + if (!barfIfClinitMissing && rms1[i].getName().equals("<clinit>")) + continue; + errors.append("Couldn't find " + rms1[i].toString() + " in the reflection set\n"); + } + } + assertTrue("Errors:" + errors.toString(), errors.length() == 0); + + // the good old ibm vm seems to offer clinit through its reflection support (see pr145322) + if (rms1.length == rms2.length) + return; + if (barfIfClinitMissing) { + // the numbers must be exact + assertEquals(rms1.length, rms2.length); + } else { + // the numbers can be out by one in favour of bcel + if (rms1.length != (rms2.length + 1)) { + for (int i = 0; i < rms1.length; i++) { + System.err.println("bcel" + i + " is " + rms1[i]); } - for (int i = 0; i < rms2.length; i++) { - System.err.println("refl"+i+" is "+rms2[i]); + for (int i = 0; i < rms2.length; i++) { + System.err.println("refl" + i + " is " + rms2[i]); } - } - assertTrue("Should be one extra (clinit) in BCEL case, but bcel="+rms1.length+" reflect="+rms2.length,rms1.length==rms2.length+1); - } - } - - public void testArrayArgsSig() throws Exception { - Method invokeMethod = Method.class.getMethod("invoke", new Class[] { Object.class, Object[].class}); - ResolvedMember reflectionMethod = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMethod(invokeMethod, world); - String exp = "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;"; - assertTrue("Expected: \n"+exp+"\n but got:\n"+reflectionMethod.getSignature(), reflectionMethod.getSignature().equals(exp)); - } - - // todo: array of int + } + assertTrue("Should be one extra (clinit) in BCEL case, but bcel=" + rms1.length + " reflect=" + rms2.length, + rms1.length == rms2.length + 1); + } + } + + public void testArrayArgsSig() throws Exception { + Method invokeMethod = Method.class.getMethod("invoke", new Class[] { Object.class, Object[].class }); + ResolvedMember reflectionMethod = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMethod(invokeMethod, world); + String exp = "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;"; + assertTrue("Expected: \n" + exp + "\n but got:\n" + reflectionMethod.getSignature(), reflectionMethod.getSignature() + .equals(exp)); + } + + // todo: array of int protected void setUp() throws Exception { world = new ReflectionWorld(getClass().getClassLoader()); diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java b/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java index 39c5ccb5c..5c08cf892 100644 --- a/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java +++ b/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java @@ -14,6 +14,7 @@ package org.aspectj.weaver.reflect; import junit.framework.TestCase; import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.World; public class ReflectionWorldTest extends TestCase { @@ -22,20 +23,20 @@ public class ReflectionWorldTest extends TestCase { World world = new ReflectionWorld(getClass().getClassLoader()); ResolvedType rt = world.resolve("java.lang.Object"); assertNotNull(rt); - assertEquals("Ljava/lang/Object;",rt.getSignature()); + assertEquals("Ljava/lang/Object;", rt.getSignature()); } - + public void testArrayTypes() { IReflectionWorld world = new ReflectionWorld(getClass().getClassLoader()); String[] strArray = new String[1]; ResolvedType rt = world.resolve(strArray.getClass()); assertTrue(rt.isArray()); } - + public void testPrimitiveTypes() { IReflectionWorld world = new ReflectionWorld(getClass().getClassLoader()); - assertEquals("int",ResolvedType.INT,world.resolve(int.class)); - assertEquals("void",ResolvedType.VOID,world.resolve(void.class)); + assertEquals("int", UnresolvedType.INT, world.resolve(int.class)); + assertEquals("void", UnresolvedType.VOID, world.resolve(void.class)); } - + } |