summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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("");
}