From: aclement Date: Tue, 18 May 2004 15:53:30 +0000 (+0000) Subject: Fix for Bugzilla Bug 62458 X-Git-Tag: V1_2_0~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b8d69e0fb755e3565831662007cef08118b24bd5;p=aspectj.git Fix for Bugzilla Bug 62458 An if() pointcut inside a perthis() clause causes an ABORT - null pointer exception in ajc --- 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) {