]> source.dussan.org Git - aspectj.git/commitdiff
test case and fix for (.....)+ type pattern parsing
authoracolyer <acolyer>
Fri, 12 Aug 2005 11:43:38 +0000 (11:43 +0000)
committeracolyer <acolyer>
Fri, 12 Aug 2005 11:43:38 +0000 (11:43 +0000)
tests/bugs150/AnnotationPlusPatternParseError.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/PatternParser.java

diff --git a/tests/bugs150/AnnotationPlusPatternParseError.aj b/tests/bugs150/AnnotationPlusPatternParseError.aj
new file mode 100644 (file)
index 0000000..0c22916
--- /dev/null
@@ -0,0 +1,24 @@
+import java.lang.annotation.*;
+
+public aspect AnnotationPlusPatternParseError {
+        
+       pointcut bar() : call(* (@MemberOfMonitoredSet *)+.*(..));
+       
+       declare warning : bar() : "humbug";
+       
+}
+
+@interface MemberOfMonitoredSet {}
+
+@MemberOfMonitoredSet
+interface I {}
+
+class C implements I {
+       
+       void bar() {
+               foo();
+       }
+       
+       public void foo() {};
+       
+}
\ No newline at end of file
index 36b3a0b91e5812f89e5372769151fa0b0a9e50d5..fdab101dbfd851bfd3f99f24af1a3a02ae884733 100644 (file)
@@ -196,6 +196,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("IllegalStateException unpacking signature of nested parameterized type");
   }
   
+  public void testParseErrorOnAnnotationStarPlusPattern() {
+         runTest("(@Foo *)+ type pattern parse error");
+  }
+  
   public void testMissingNamePattern_pr106461() { runTest("missing name pattern"); }
   
   // helper methods.....
index 9dfbe2f914a607fdb21c89675589db92bba62ad5..d94182d555c9fdc1ee86361d505ecd1759766e53 100644 (file)
         <compile files="pr106634.aj" options="-1.5"/>
     </ajc-test>
         
+    <ajc-test dir="bugs150" title="(@Foo *)+ type pattern parse error">
+        <compile files="AnnotationPlusPatternParseError.aj" options="-1.5"/>
+    </ajc-test>
+        
     <ajc-test dir="../docs/dist/doc/examples/introduction" title="introduction sample" vm="1.5">
         <compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.5"/>
     </ajc-test>
      </run>
    </ajc-test>
             
+  <ajc-test dir="java5/generics/genericaspects" title="generic aspect declare parents">
+     <compile files="DeclareParentsWithTypeVars.aj" options="-1.5">
+     </compile>
+     <run class="DeclareParentsWithTypeVars">
+     </run>
+   </ajc-test>
+               
    <!-- ajdk example -->
    <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 5 (ajdk)">
      <compile files="Blob.java,BlobContainment.aj,ParentChildRelationship.aj" options="-1.5"/>
index 76060b1b64d8aff0b0124bdfd9d522db35a45142..640762f913784e68552bcec9e3123d7f6ad98607 100644 (file)
@@ -587,7 +587,9 @@ public class PatternParser {
                        p = setAnnotationPatternForTypePattern(p,ap);
                        eat(")");
                        boolean isVarArgs = maybeEat("...");
-                       p.setIsVarArgs(isVarArgs);
+                       if (isVarArgs) p.setIsVarArgs(isVarArgs);
+                       boolean isIncludeSubtypes = maybeEat("+");
+                       if (isIncludeSubtypes) p.includeSubtypes = true;  // need the test because (A+) should not set subtypes to false!
                        return p;
                }
                int startPos = tokenSource.peek().getStart();