]> source.dussan.org Git - aspectj.git/commitdiff
Fix for 112243: incorrect entries in type map. Includes fix for this case and guards...
authoraclement <aclement>
Thu, 13 Oct 2005 10:44:13 +0000 (10:44 +0000)
committeraclement <aclement>
Thu, 13 Oct 2005 10:44:13 +0000 (10:44 +0000)
weaver/src/org/aspectj/weaver/World.java
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java

index e68bcaf25e504309cb55f3930bc0f4206b2bac5c..423898524de8674476110d4359a6966e3d4e6d84 100644 (file)
@@ -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);
index 0fe339afd4ac2374426a51ab1e38636a32a306a7..4676740425f09c4d6dce11ba363e603f0b29341f 100644 (file)
@@ -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);