return this.world;
}
+ protected ReflectionWorld getReflectionWorld() {
+ return (ReflectionWorld) this.world;
+ }
+
public ReferenceType buildGenericType() {
throw new UnsupportedOperationException("Shouldn't be asking for generic type at 1.4 source level or lower");
Class[] reflectInterfaces = this.myClass.getInterfaces();
this.interfaces = new ResolvedType[reflectInterfaces.length];
for (int i = 0; i < reflectInterfaces.length; i++) {
- this.interfaces[i] = world.resolve(reflectInterfaces[i].getName());
+ this.interfaces[i] = getReflectionWorld().resolve(reflectInterfaces[i]);
}
}
return interfaces;
*/
public ResolvedType getSuperclass() {
if (this.myClass.getSuperclass() == null) return null;
- return world.resolve(this.myClass.getSuperclass().getName());
+ return getReflectionWorld().resolve(this.myClass.getSuperclass());
}
/* (non-Javadoc)
private static ResolvedType[] toResolvedTypeArray(Class[] classes, World inWorld) {
ResolvedType[] ret = new ResolvedType[classes.length];
for (int i = 0; i < ret.length; i++) {
- ret[i] = inWorld.resolve(classes[i].getName());
+ ret[i] = ((ReflectionWorld)inWorld).resolve(classes[i]);
}
return ret;
}
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.ResolvedTypeMunger;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
import org.aspectj.weaver.AjAttribute.AdviceAttribute;
import org.aspectj.weaver.patterns.Pointcut;
setBehaveInJava5Way(LangUtil.is15VMOrGreater());
}
+ public ResolvedType resolve(Class aClass) {
+ // classes that represent arrays return a class name that is the signature of the array type, ho-hum...
+ String className = aClass.getName();
+ if (!className.startsWith("[")) {
+ return resolve(className);
+ } else {
+ return resolve(UnresolvedType.forSignature(className));
+ }
+ }
+
/* (non-Javadoc)
* @see org.aspectj.weaver.World#resolveDelegate(org.aspectj.weaver.ReferenceType)
*/
package org.aspectj.weaver.reflect;
import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
import junit.framework.TestCase;
assertEquals("Ljava/lang/Object;",rt.getSignature());
}
+ public void testArrayTypes() {
+ World world = new ReflectionWorld();
+ String[] strArray = new String[1];
+ ResolvedType rt = world.resolve(UnresolvedType.forSignature(strArray.getClass().getName()));
+ assertTrue(rt.isArray());
+ }
+
}