aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/AroundExceptions.java
blob: 81bb1e44514cb67b6aa9f7322439cd9328a2a5af (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
import org.aspectj.testing.Tester;
import java.io.IOException;

public class AroundExceptions {
    public static void main(String[] args) {
	new SubC().m();
	Tester.checkAndClear("around-reception caught-IOException", "subc.m");

	new C().m();
	Tester.checkAndClear("around-reception", "c.m");
    }
}

class C {
    public void m() throws IOException {
    }
}

class SubC extends C {
    public void m() throws IOException {
	throw new IOException();
    }
}
    


aspect A {
    void around (): call(void C.m()) {
	Tester.note("around-reception");
	proceed();
    }

    void around(): call(void C+.m()) {
	try {
	    proceed();
	} catch (IOException ioe) {
	    Tester.note("caught-IOException");
	}
    }
}