blob: 0719f299317e4062e471e109e111d3568fe68dcd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import org.aspectj.testing.Tester;
public class ErrorWarning {
public static void main (String[] args) {
boolean passed = true;
try { ok(); }
catch (Error e) { passed = false; }
Tester.check(passed, "did not catch error");
} // end of main ()
public static void ok() {
try {
throw new Error();; // CE 13 unless -lenient
} catch(Error e) { } // CW 14 per aspect
}
static aspect A {
declare warning : withincode(void ErrorWarning.ok())
&& (handler(Error)) : "warning";
}
}
|