]> source.dussan.org Git - aspectj.git/commitdiff
fixed Bug 31423: adviceexecution not working
authorjhugunin <jhugunin>
Thu, 13 Feb 2003 22:24:56 +0000 (22:24 +0000)
committerjhugunin <jhugunin>
Thu, 13 Feb 2003 22:24:56 +0000 (22:24 +0000)
tests/ajcTests.xml
tests/bugs/AdviceExec.java [new file with mode: 0644]
weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java
weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java

index 15864594ad2d3be6c3deb9b13fe0c011d1f8889a..ab1a6fe0da2d3aa882691b72978c3e284b1357eb 100644 (file)
         <run class="test.Test3"/>
     </ajc-test>
 
+    <ajc-test dir="bugs" pr="31423" 
+               title="Pointcut adviceexecution() does not work">
+        <compile files="AdviceExec.java"/>
+        <run class="AdviceExec"/>
+    </ajc-test>
+
 </suite>
diff --git a/tests/bugs/AdviceExec.java b/tests/bugs/AdviceExec.java
new file mode 100644 (file)
index 0000000..7d28f28
--- /dev/null
@@ -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++;
+    }
+}
index 207f582599a0364e80573fb8efc753c7928b770b..6003e8f7478b705d2776f9079ed0b3c48b869f83 100644 (file)
@@ -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;
index fe6f656c75339ced9e2f9988722b3923e15f9b8e..f6b0912893cf7cd465df6ac98cc872153d5438c0 100644 (file)
@@ -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) {