]> source.dussan.org Git - aspectj.git/commitdiff
fix and test case for pr79523: BCException: illegal change to pointcut declaration...
authoracolyer <acolyer>
Fri, 19 Aug 2005 19:51:32 +0000 (19:51 +0000)
committeracolyer <acolyer>
Fri, 19 Aug 2005 19:51:32 +0000 (19:51 +0000)
tests/bugs150/pr79523.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java

diff --git a/tests/bugs150/pr79523.aj b/tests/bugs150/pr79523.aj
new file mode 100644 (file)
index 0000000..6456b00
--- /dev/null
@@ -0,0 +1,6 @@
+public aspect pr79523 {
+       
+       pointcut someCalls(String str) : call(*.new(String)) && args(str);
+       declare warning : someCalls(str) : "not allowed"; // CE L 4
+       
+}
\ No newline at end of file
index cfd7a5fc3a270a15a425b98566df57a62e662743..5827bc4451016696e8614cf3a734681c3b2784df 100644 (file)
@@ -246,6 +246,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("@SuppressWarnings should suppress");
   }
   
+  public void testDEOWWithBindingPointcut() {
+         runTest("declare warning : foo(str) : ...;");
+  }
+  
   // helper methods.....
   
   public SyntheticRepository createRepos(File cpentry) {
index f8e1a2e7aae5699fa4f9b02dfa45531501d5fb73..9551abe56b3b3fabe815809f21c7faca9902d337 100644 (file)
         </compile>
     </ajc-test>
             
-            
+    <ajc-test dir="bugs150" pr="79523" title="declare warning : foo(str) : ...;">
+        <compile files="pr79523.aj">
+            <message line="4" kind="warning" text="no match for this type name: str"/>
+            <message line="4" kind="error" text="bad parameter"/>
+            <message line="4" kind="error" text="args() pointcut designator cannot be used in declare statement"/>
+        </compile>
+    </ajc-test>
+                        
     <ajc-test dir="bugs150" pr="107059" title="parser crashes on call(void (@a *)(..)">
         <compile files="pr107059.aj">
             <message line="3" kind="error" text="Syntax error on token &quot;(&quot;, &quot;name pattern&quot; expected"/>
index ec6c3628981b260d7562e1b2ded4193a55cec202..6c0ff20c5cc5142072b0f2477a054525a675ad11 100644 (file)
@@ -298,6 +298,7 @@ public class ReferencePointcut extends Pointcut {
                        IntMap newBindings = new IntMap();
                        for (int i=0,len=arguments.size(); i < len; i++) {
                                TypePattern p = arguments.get(i);
+                               if (p == TypePattern.NO) continue;
                                //we are allowed to bind to pointcuts which use subtypes as this is type safe
                                if (!p.matchesSubtypes(parameterTypes[i])  && 
                                        !p.getExactType().equals(UnresolvedType.OBJECT))