]> source.dussan.org Git - aspectj.git/commitdiff
pr145693 - fix for part 1
authoraclement <aclement>
Wed, 5 Jul 2006 12:48:36 +0000 (12:48 +0000)
committeraclement <aclement>
Wed, 5 Jul 2006 12:48:36 +0000 (12:48 +0000)
tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java

index 8e09602c43c78639e2e5d71489abf5f00a31560d..18b1f86e02f12443091bbd033e33015172b36330 100644 (file)
@@ -29,7 +29,10 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        runTest("verification problem");   // build the code
        Utils.verifyClass(ajc,"mypackage.MyAspect"); // verify it <<< BRAND NEW VERIFY UTILITY FOR EVERYONE TO TRY ;)
   }
-  public void testIncorrectAnnotationValue_pr148537() { runTest("incorrect annotation value");}
+  public void testIncorrectAnnotationValue_pr148537()    { runTest("incorrect annotation value");}
+  public void testVerifyErrNoTypeCflowField_pr145693_1() {     runTest("verifyErrNoTypeCflowField"); }
+//  public void testVerifyErrInpathNoTypeCflowField_pr145693_2() { runTest("verifyErrInpathNoTypeCflowField"); }
+//  public void testCpathNoTypeCflowField_pr145693_3()     { runTest("cpathNoTypeCflowField"); }
 
   
   /////////////////////////////////////////
@@ -40,5 +43,6 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   protected File getSpecFile() {
     return new File("../tests/src/org/aspectj/systemtest/ajc153/ajc153.xml");
   }
+
   
 }
\ No newline at end of file
index 4bc76dd65ad4a5bb6c547831ba5450cf60497fa6..6024e6557cda796fd14a038d7b14ab398bf25894 100644 (file)
                </compile>
     </ajc-test>
     
+    <ajc-test dir="bugs153/pr145693" title="verifyErrNoTypeCflowField">
+      <compile files="Event.java" outjar="cpath.jar"/>
+      <compile files="Monitor.aj" outjar="apath.jar" classpath="cpath.jar"/>
+      <compile files="Sample.java" options="-Xlint:ignore" aspectpath="apath.jar" outjar="run.jar">
+        <message kind="warning" line="8" text="Unable to determine match at this join point because the type 'Event' cannot be found"/>
+      </compile>
+      <run class="Sample" classpath="run.jar,apath.jar">
+        <stderr>
+          <line text="method running"/>
+        </stderr>
+      </run>
+    </ajc-test>    
+
+    <ajc-test dir="bugs153/pr145693" title="verifyErrInpathNoTypeCflowField">
+      <compile files="Event.java" outjar="cpath.jar"/>
+      <compile files="Monitor.aj" outjar="apath.jar" classpath="cpath.jar"/>
+      <compile files="Sample.java" options="-Xlint:ignore" inpath="cpath.jar" aspectpath="apath.jar" outjar="run.jar"/>
+      <run class="Sample" classpath="run.jar,apath.jar"/>
+    </ajc-test>    
+
+    <ajc-test dir="bugs153/pr145693" title="cpathNoTypeCflowField">
+      <compile files="Event.java" outjar="cpath.jar"/>
+      <compile files="Monitor.aj" outjar="apath.jar" classpath="cpath.jar"/>
+      <compile files="Sample.java" options="-Xlint:ignore" classpath="cpath.jar" aspectpath="apath.jar" outjar="run.jar"/>
+      <run class="Sample" classpath="run.jar,apath.jar"/>
+    </ajc-test>    
     
 </suite>
\ No newline at end of file
index 01f4c388891875e76e7f00f00b45999d4404b691..1053dbe8277473efb1c6717576c97777dccb9024 100644 (file)
@@ -19,6 +19,8 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.Message;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.Member;
@@ -27,6 +29,7 @@ import org.aspectj.weaver.NameMangler;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.ast.Expr;
 import org.aspectj.weaver.ast.Test;
 import org.aspectj.weaver.bcel.BcelCflowAccessVar;
@@ -55,6 +58,24 @@ public class ConcreteCflowPointcut extends Pointcut {
          
        protected FuzzyBoolean matchInternal(Shadow shadow) {
                //??? this is not maximally efficient
+               // Check we'll be able to do the residue!
+               
+               // this bit is for pr145693 - we cannot match at all if one of the types is missing, we will be unable
+               // to create the residue
+                if (slots != null) { 
+                   for (Iterator i = slots.iterator(); i.hasNext();) {
+                         Slot slot = (Slot) i.next();
+                         ResolvedType rt = slot.formalType;
+                         if (rt.isMissing()) {
+                                 ISourceLocation[] locs = new ISourceLocation[]{getSourceLocation()};
+                                 Message m = new Message(
+                                   WeaverMessages.format(WeaverMessages.MISSING_TYPE_PREVENTS_MATCH,rt.getName()),
+                                                 "",Message.WARNING,shadow.getSourceLocation(),null,locs);
+                                 rt.getWorld().getMessageHandler().handleMessage(m);
+                                 return FuzzyBoolean.NO;
+                         }
+                   }
+                }
                return FuzzyBoolean.MAYBE;
        }