From: aclement Date: Thu, 7 Jan 2010 03:28:24 +0000 (+0000) Subject: apparently cracked the long standing issue of recursive exception in isAssignableFrom X-Git-Tag: V1_6_8~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a1fe853372c385b27f8451683204def9d89ec165;p=aspectj.git apparently cracked the long standing issue of recursive exception in isAssignableFrom --- 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,13 +357,42 @@ 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; return resolved; } + /** + * 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. */