aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java8
-rw-r--r--weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java2
-rw-r--r--weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java11
-rw-r--r--weaver/testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java8
4 files changed, 26 insertions, 3 deletions
diff --git a/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java b/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java
index 69ae60a8e..75605b5ed 100644
--- a/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java
+++ b/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java
@@ -64,6 +64,10 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega
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");
@@ -193,7 +197,7 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega
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;
@@ -278,7 +282,7 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega
*/
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)
diff --git a/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java b/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
index 52eefe0b6..619e5099a 100644
--- a/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
+++ b/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
@@ -148,7 +148,7 @@ public class ReflectionBasedReferenceTypeDelegateFactory {
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;
}
diff --git a/weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java b/weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java
index 3fd57314f..789dc5806 100644
--- a/weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java
+++ b/weaver/src/org/aspectj/weaver/reflect/ReflectionWorld.java
@@ -23,6 +23,7 @@ import org.aspectj.weaver.ReferenceTypeDelegate;
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;
@@ -42,6 +43,16 @@ public class ReflectionWorld extends World {
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)
*/
diff --git a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java b/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java
index 8f0942725..4bc879dae 100644
--- a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java
+++ b/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java
@@ -12,6 +12,7 @@
package org.aspectj.weaver.reflect;
import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
import junit.framework.TestCase;
@@ -25,4 +26,11 @@ public class ReflectionWorldTest extends 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());
+ }
+
}