diff options
author | acolyer <acolyer> | 2005-10-24 20:46:51 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-10-24 20:46:51 +0000 |
commit | 17d987fec6ed69281e8427b60c5cb4d9cd305b0f (patch) | |
tree | fbc9f63b6ce7e1d60f50f4f5ebb017fb4e7d6c69 /weaver/src | |
parent | 70888ddc862b717646b236db2767e11a586b6157 (diff) | |
download | aspectj-17d987fec6ed69281e8427b60c5cb4d9cd305b0f.tar.gz aspectj-17d987fec6ed69281e8427b60c5cb4d9cd305b0f.zip |
ensure that reflection based world can cope when given a java.lang.Class that represents an array type (such a class has a "name" that is actually the signature string).
Diffstat (limited to 'weaver/src')
3 files changed, 18 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) */ |