summaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authoraclement <aclement>2010-01-07 03:28:24 +0000
committeraclement <aclement>2010-01-07 03:28:24 +0000
commita1fe853372c385b27f8451683204def9d89ec165 (patch)
tree9c28af3a1535bad4019813080b5bba016d87e15d /org.aspectj.matcher
parentfe3e4e542930d7ea4b516823c4258ca7df782c6d (diff)
downloadaspectj-a1fe853372c385b27f8451683204def9d89ec165.tar.gz
aspectj-a1fe853372c385b27f8451683204def9d89ec165.zip
apparently cracked the long standing issue of recursive exception in isAssignableFrom
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/World.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/org/aspectj/weaver/World.java
index 0c0375b3f..bcebed34d 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/World.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/World.java
@@ -357,7 +357,8 @@ public abstract class World implements Dump.INode {
}
ResolvedType resolved = typeMap.get(ty.getSignature());
if (resolved == null) {
- typeMap.put(ty.getSignature(), ty);
+ resolved = ensureRawTypeIfNecessary(ty);
+ typeMap.put(ty.getSignature(), resolved);
resolved = ty;
}
resolved.world = this;
@@ -365,6 +366,34 @@ public abstract class World implements Dump.INode {
}
/**
+ * When the world is operating in 1.5 mode, the TypeMap should only contain RAW types and never directly generic types. The RAW
+ * type will contain a reference to the generic type.
+ *
+ * @param type a possibly generic type for which the raw needs creating as it is not currently in the world
+ * @return a type suitable for putting into the world
+ */
+ private ResolvedType ensureRawTypeIfNecessary(ResolvedType type) {
+ if (!isInJava5Mode()) {
+ // Don't care, not running in 1.5 mode
+ return type;
+ }
+ if (type.isRawType()) {
+ return type;
+ }
+ // Key requirement here is if it is generic, create a RAW entry to be put in the map that points to it
+ if (type instanceof ReferenceType && ((ReferenceType) type).getDelegate() != null && type.isGenericType()) {
+ ReferenceType rawType = new ReferenceType(type.getSignature(), this);
+ rawType.typeKind = UnresolvedType.TypeKind.RAW;
+ ReferenceTypeDelegate delegate = ((ReferenceType) type).getDelegate();
+ rawType.setDelegate(delegate);
+ rawType.setGenericType((ReferenceType) type);
+ return rawType;
+ }
+ // probably parameterized...
+ return type;
+ }
+
+ /**
* Convenience method for finding a type by name and resolving it in one step.
*/
public ResolvedType resolve(String name) {