aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/PR535.java
blob: 9bea781b6d65edf73d3dbc5432f9a543431ba0d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import org.aspectj.testing.Tester; 

/** @testcase PR#535 */
public class PR535 {
    public static void main(String[] args) {
        Tester.expectEvent("In bar()");
        Tester.expectEvent("advice");
        Tester.expectEvent("In foo()");
        new C().foo();
        Tester.checkAllEvents();
    }
}

class C {

    public void foo() {
        Tester.event("In foo()");
        bar();
    }

    public void bar() {
        Tester.event("In bar()");
    }
}

aspect A {
   pointcut outside(): !cflow(within(A));

    void around(C c):
        cflow(execution(public void C.foo())) &&
        target(c) &&
        execution(public void C.bar()) &&
        outside() {
        Tester.event("advice");
        proceed(c);
    }
}