summaryrefslogtreecommitdiffstats
path: root/tests/new/AfterThrowingNonThrowable.java
blob: 108d2cd7ae7389a8f2630e5c1051c47d9f725c5a (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
39
40
41
42
43
44
import org.aspectj.testing.Tester;
import java.util.*;

/** @testcase PR#832 after throwing advice with non-throwable formal */
public class AfterThrowingNonThrowable {

    public static void main(String[] args) {
        U.ee("after() throwing (Object o) : call(void C.run())");
        U.ee("run()");
        C c = new C();
        boolean gotError = false;
        try {
            c.run();
        } catch (Error e) {
            gotError = true;
        }
        Tester.check(gotError, "failed to get error");
        Tester.checkAllEvents();
    }
}

class C {
    public void run() {
        U.e("run()");
        throw new Error("");
    }
}

class U {
    static void e(String event) {
        //System.err.println(event);
        Tester.event(event);
    }
    static void ee(String event) {
        Tester.expectEvent(event);
    }
}

aspect A {
    after() throwing (Object o) : call(void C.run()) {
        U.e("after() throwing (Object o) : call(void C.run())");
    }
}