From 04e8dca2fc16f5f834e124b7abea5847d90c3366 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 13 Oct 2005 10:44:13 +0000 Subject: [PATCH] Fix for 112243: incorrect entries in type map. Includes fix for this case and guards to give better info if it ever happens again. --- weaver/src/org/aspectj/weaver/World.java | 5 +++++ .../src/org/aspectj/weaver/bcel/BcelWorld.java | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/World.java b/weaver/src/org/aspectj/weaver/World.java index e68bcaf25..423898524 100644 --- a/weaver/src/org/aspectj/weaver/World.java +++ b/weaver/src/org/aspectj/weaver/World.java @@ -684,6 +684,11 @@ public abstract class World implements Dump.INode { System.err.println("Not putting a bounded reference type into the typemap: key="+key+" type="+type); return type; } + if (type instanceof MissingResolvedTypeWithKnownSignature) { + if (debug) + System.err.println("Not putting a missing type into the typemap: key="+key+" type="+type); + return type; + } if (isExpendable(type)) { return (ResolvedType) expendableMap.put(key,type); diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java index 0fe339afd..467674042 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java @@ -41,6 +41,7 @@ import org.aspectj.bridge.IMessageHandler; import org.aspectj.weaver.Advice; import org.aspectj.weaver.AdviceKind; import org.aspectj.weaver.AjAttribute; +import org.aspectj.weaver.BCException; import org.aspectj.weaver.ConcreteTypeMunger; import org.aspectj.weaver.ICrossReferenceHandler; import org.aspectj.weaver.Member; @@ -273,8 +274,19 @@ public class BcelWorld extends World implements Repository { public BcelObjectType addSourceObjectType(JavaClass jc) { BcelObjectType ret = null; String signature = UnresolvedType.forName(jc.getClassName()).getSignature(); - ReferenceType nameTypeX = (ReferenceType)typeMap.get(signature); - + + Object fromTheMap = typeMap.get(signature); + + if (fromTheMap!=null && !(fromTheMap instanceof ReferenceType)) { + // what on earth is it then? See pr 112243 + StringBuffer exceptionText = new StringBuffer(); + exceptionText.append("Found invalid (not a ReferenceType) entry in the type map. "); + exceptionText.append("Signature=["+signature+"] Found=["+fromTheMap+"] Class=["+fromTheMap.getClass()+"]"); + throw new BCException(exceptionText.toString()); + } + + ReferenceType nameTypeX = (ReferenceType)fromTheMap; + if (nameTypeX == null) { if (jc.isGeneric()) { nameTypeX = ReferenceType.fromTypeX(UnresolvedType.forRawTypeName(jc.getClassName()),this); -- 2.39.5