From: acolyer Date: Fri, 12 Aug 2005 11:43:38 +0000 (+0000) Subject: test case and fix for (.....)+ type pattern parsing X-Git-Tag: V1_5_0M3~139 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fe02f87368665c4f014e0be4525ed2d443967037;p=aspectj.git test case and fix for (.....)+ type pattern parsing --- diff --git a/tests/bugs150/AnnotationPlusPatternParseError.aj b/tests/bugs150/AnnotationPlusPatternParseError.aj new file mode 100644 index 000000000..0c22916ee --- /dev/null +++ b/tests/bugs150/AnnotationPlusPatternParseError.aj @@ -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 diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index 36b3a0b91..fdab101db 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -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..... diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 9dfbe2f91..d94182d55 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -186,6 +186,10 @@ + + + + @@ -2371,6 +2375,13 @@ + + + + + + + diff --git a/weaver/src/org/aspectj/weaver/patterns/PatternParser.java b/weaver/src/org/aspectj/weaver/patterns/PatternParser.java index 76060b1b6..640762f91 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PatternParser.java +++ b/weaver/src/org/aspectj/weaver/patterns/PatternParser.java @@ -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();