summaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authoraclement <aclement>2008-12-05 18:41:39 +0000
committeraclement <aclement>2008-12-05 18:41:39 +0000
commita4d35810d8f5a16b55cfa3ecd225e3b258892cad (patch)
tree78f0926b67488d9ab0a60ec01fb479be0828f273 /org.aspectj.matcher
parent368883bf8494e552daf9194d9885c858997fd876 (diff)
downloadaspectj-a4d35810d8f5a16b55cfa3ecd225e3b258892cad.tar.gz
aspectj-a4d35810d8f5a16b55cfa3ecd225e3b258892cad.zip
256458: test and fix: better message for if() pointcut anno style problems
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java
index d1ecd551b..75929e7a1 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java
@@ -366,7 +366,11 @@ public class PatternParser {
eat(")");
p = new KindedPointcut(Shadow.PreInitialization, sig);
} else if (kind.equals("if")) {
- // @style support allows if(), if(true), if(false)
+ // - annotation style only allows if(), if(true) or if(false)
+ // - if() means the body of the annotated method represents the if expression
+ // - anything else is an error because code cannot be put into the if()
+ // - code style will already have been processed and the call to maybeGetParsedPointcut()
+ // at the top of this method will have succeeded.
eat("(");
if (maybeEatIdentifier("true")) {
eat(")");
@@ -375,7 +379,11 @@ public class PatternParser {
eat(")");
p = new IfPointcut.IfFalsePointcut();
} else {
- eat(")");
+ if (!maybeEat(")")) {
+ throw new ParserException(
+ "in annotation style, if(...) pointcuts cannot contain code. Use if() and put the code in the annotated method",
+ t);
+ }
// TODO - Alex has some token stuff going on here to get a readable name in place of ""...
p = new IfPointcut("");
}