From: jhugunin Date: Thu, 13 Feb 2003 22:24:56 +0000 (+0000) Subject: fixed Bug 31423: adviceexecution not working X-Git-Tag: V_1_1_b5~43 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=19c3e16d2212bdd41144da2150c8ef46b4a759a5;p=aspectj.git fixed Bug 31423: adviceexecution not working --- diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 15864594a..ab1a6fe0d 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -5573,4 +5573,10 @@ + + + + + diff --git a/tests/bugs/AdviceExec.java b/tests/bugs/AdviceExec.java new file mode 100644 index 000000000..7d28f28fe --- /dev/null +++ b/tests/bugs/AdviceExec.java @@ -0,0 +1,31 @@ +// for Bug#: 31423 +import org.aspectj.testing.Tester; + + +public class AdviceExec { + public static void main(String[] args) { + Tester.checkEqual(Aspect1.ran, 2, "Aspect1 ran"); + Tester.checkEqual(Aspect2.ran, 2, "Aspect2 ran"); + } +} + +aspect Aspect1 { + static int ran = 0; + before() : execution(* AdviceExec.*(..)) { + //System.out.println("Reached " + thisJoinPoint); + ran++; + } + + void around(): execution(* AdviceExec.*(..)) { + ran++; + proceed(); + } +} + +aspect Aspect2 { + static int ran = 0; + before() : adviceexecution() && !within(Aspect2) { + //System.out.println("Reached " + thisJoinPoint); + ran++; + } +} diff --git a/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java b/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java index 207f58259..6003e8f74 100644 --- a/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java @@ -35,8 +35,6 @@ public class KindedPointcut extends Pointcut { public boolean fastMatch(JavaClass jc) { return true; } public FuzzyBoolean match(Shadow shadow) { - - if (shadow.getKind() != kind) return FuzzyBoolean.NO; if (!signature.matches(shadow.getSignature(), shadow.getIWorld())) return FuzzyBoolean.NO; diff --git a/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java b/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java index fe6f656c7..f6b091289 100644 --- a/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java @@ -85,6 +85,8 @@ public class SignaturePattern extends PatternNode { world.getLint().unresolvableMember.signal(member.toString(), getSourceLocation()); return false; } + if (kind == Member.ADVICE) return true; + if (!modifiers.matches(sig.getModifiers())) return false; if (kind == Member.STATIC_INITIALIZATION) {