aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/AdviceOnAdviceRecursion.java
blob: fe0752d20e5d5f07023c7d03c2fb130604a99b63 (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
import org.aspectj.testing.*;

/** PR#745 stack overflow expected when advice recurses into itself */
public class AdviceOnAdviceRecursion { // XXX n-aspect variant?
    public static void main (String[] args) {
        boolean passed = false;
        Throwable ex = null;
        try {
            C.m();
        } catch (StackOverflowError e) {
            passed = true;
        } catch (Throwable e) {
            ex = e;
        }
        Tester.check(passed, "expected StackOverflowError, got " + ex);
    }
}

class C {
    static void m() { ; }
}

aspect A {
    before() : within(C) || within(B) { 
        C.m();
    }
}

aspect B {
    before() : call(void m()) { }
}