aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/ThrowsMatching.java
blob: 6f350d9d45373da0ee2f3b9ff2ba7b6fe70469b9 (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
import org.aspectj.testing.Tester;

public class ThrowsMatching {
    public static void main(String[] args) throws Exception {
        C c = new C();
        c.m1();
        c.m2();

        Tester.checkEqual(A.buf.toString(), "before:m1:m2:");
    }
}


class E1 extends Exception { }

class C {
    public void m1() throws E1 { A.buf.append("m1:"); }
    public void m2() { A.buf.append("m2:"); }
}

aspect A {
    static StringBuffer buf = new StringBuffer();

    before(): call(void C.m*() throws E1) { A.buf.append("before:"); }
}