]> source.dussan.org Git - aspectj.git/commitdiff
Two more "cant find types" dealt with.
authoraclement <aclement>
Mon, 23 Aug 2004 08:19:04 +0000 (08:19 +0000)
committeraclement <aclement>
Mon, 23 Aug 2004 08:19:04 +0000 (08:19 +0000)
weaver/src/org/aspectj/weaver/WeaverMessages.java
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
weaver/src/org/aspectj/weaver/weaver-messages.properties

index ced85c5076cd63c5028f90668ba95cd9c154ddbf..c8351b5f71e14afd5f02e9bc417d6ecb9989bb56 100644 (file)
@@ -73,6 +73,9 @@ public class WeaverMessages {
        public static final String CANT_FIND_TYPE = "cantFindType";
        public static final String CANT_FIND_CORE_TYPE = "cantFindCoreType";
        public static final String CANT_FIND_TYPE_WITHINPCD = "cantFindTypeWithinpcd";
+    public static final String CANT_FIND_TYPE_DURING_AROUND_WEAVE = "cftDuringAroundWeave";
+    public static final String CANT_FIND_TYPE_DURING_AROUND_WEAVE_PREINIT = "cftDuringAroundWeavePreinit";
+
        
        public static final String DECP_BINARY_LIMITATION = "decpBinaryLimitation";
        public static final String OVERWRITE_JSR45 = "overwriteJSR45";
index d521ed52d85bc552c69eb79bf498d164639bfa42..83abe334fee2d59f72a267ce822fc3c54d40924a 100644 (file)
@@ -43,7 +43,9 @@ import org.aspectj.apache.bcel.generic.SWAP;
 import org.aspectj.apache.bcel.generic.StoreInstruction;
 import org.aspectj.apache.bcel.generic.TargetLostException;
 import org.aspectj.apache.bcel.generic.Type;
+import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.Message;
 import org.aspectj.weaver.Advice;
 import org.aspectj.weaver.AdviceKind;
 import org.aspectj.weaver.AjcMemberMaker;
@@ -56,6 +58,7 @@ import org.aspectj.weaver.ResolvedTypeX;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
 import org.aspectj.weaver.TypeX;
+import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Var;
 
@@ -1456,7 +1459,14 @@ public class BcelShadow extends Shadow {
                 
                // !!! THIS BLOCK OF CODE SHOULD BE IN A METHOD CALLED weaveAround(...);
         Member mungerSig = munger.getSignature();
-        ResolvedTypeX declaringType = world.resolve(mungerSig.getDeclaringType());
+        ResolvedTypeX declaringType = world.resolve(mungerSig.getDeclaringType(),true);
+        if (declaringType == ResolvedTypeX.MISSING) {
+          IMessage msg = new Message(
+                WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_DURING_AROUND_WEAVE,declaringType.getClassName()),
+                "",IMessage.ERROR,getSourceLocation(),null,
+                new ISourceLocation[]{ munger.getSourceLocation()});
+          world.getMessageHandler().handleMessage(msg);
+        }
         //??? might want some checks here to give better errors
         BcelObjectType ot = BcelWorld.getBcelObjectType(declaringType); 
         
@@ -1793,11 +1803,20 @@ public class BcelShadow extends Shadow {
                        
                        returnConversionCode.append(InstructionConstants.ALOAD_0); // put "this" back on the stack
                        for (int i = 0, len = stateTypes.length; i < len; i++) {
+                TypeX bcelTX = BcelWorld.fromBcel(stateTypes[i]);
+                ResolvedTypeX stateRTX = world.resolve(bcelTX,true);
+                if (stateRTX == ResolvedTypeX.MISSING) {
+                    IMessage msg = new Message(
+                             WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_DURING_AROUND_WEAVE_PREINIT,bcelTX.getClassName()),
+                              "",IMessage.ERROR,getSourceLocation(),null,
+                              new ISourceLocation[]{ munger.getSourceLocation()});
+                    world.getMessageHandler().handleMessage(msg);
+                }
                                stateTempVar.appendConvertableArrayLoad(
                                        returnConversionCode, 
                                        fact, 
                                        i, 
-                                       world.resolve(BcelWorld.fromBcel(stateTypes[i])));
+                                       stateRTX);
                        }
                } else {
                returnConversionCode = 
index febd44ff7a353a92103fb201e479780c91f1ae6a..128016fb2efbaaf36a4d2f132af8ead9a2716b6c 100644 (file)
@@ -76,6 +76,8 @@ aspectNeeded=aspect {0} is needed when using type {1}
 cantFindType=can''t find type {0}
 cantFindCoreType=can''t find critical required type {0}
 cantFindTypeWithinpcd=Unable to find type {0} whilst processing within() pointcut at this source location
+cftDuringAroundWeave=Can't find type {0} whilst applying around advice
+cftDuringAroundWeavePreinit=Can't find type {0} whilst applying around advice to preinitialization join point
 
 # Implementation limitations...
 decpBinaryLimitation=can''t use declare parents to change superclass of binary form ''{0}'' (implementation limitation)