aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2004-05-18 15:53:30 +0000
committeraclement <aclement>2004-05-18 15:53:30 +0000
commitb8d69e0fb755e3565831662007cef08118b24bd5 (patch)
tree14560f075ac896049b1def18254272dc2cf36c6c
parent7638feeab612cf4965cbbaacead58caf481d6239 (diff)
downloadaspectj-b8d69e0fb755e3565831662007cef08118b24bd5.tar.gz
aspectj-b8d69e0fb755e3565831662007cef08118b24bd5.zip
Fix for Bugzilla Bug 62458
An if() pointcut inside a perthis() clause causes an ABORT - null pointer exception in ajc
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/IfPointcut.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java b/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java
index baf55d85b..a534f68d4 100644
--- a/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/IfPointcut.java
@@ -161,6 +161,21 @@ public class IfPointcut extends Pointcut {
}
IfPointcut ret = new IfPointcut(testMethod, extraParameterFlags);
partiallyConcretized = ret;
+
+ // It is possible to directly code your pointcut expression in a per clause
+ // rather than defining a pointcut declaration and referencing it in your
+ // per clause. If you do this, we have problems (bug #62458). For now,
+ // let's police that you are trying to code a pointcut in a per clause and
+ // put out a compiler error.
+ if (bindings.directlyInAdvice() && bindings.getEnclosingAdvice()==null) {
+ // Assumption: if() is in a per clause if we say we are directly in advice
+ // but we have no enclosing advice.
+ inAspect.getWorld().showMessage(IMessage.ERROR,
+ "if() pointcut designator cannot be used directly in a per clause (compiler limitation). Create a named pointcut containing the if() and refer to it",
+ this.getSourceLocation(),null);
+ return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
+ }
+
if (bindings.directlyInAdvice()) {
ShadowMunger advice = bindings.getEnclosingAdvice();
if (advice instanceof Advice) {