aboutsummaryrefslogtreecommitdiffstats
path: root/tests/harness/WarningTest.java
blob: e2c4fa84c5e9c828ec80c4128979e022fde49f26 (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 WarningTest {
    public static void main (String[] args) {
        boolean passed = true;
        try { ok(); } 
        catch (Error e) { passed = false; }
        Tester.check(passed, "did not catch error");
    } 
    
    public static void ok() {
        try {
            throw new Error();
        } catch(Error e) { }      // CW 14 per aspect
    }
    static aspect A {
        declare warning : withincode(void WarningTest.ok())
            && (handler(Error)) : "warning";
    }
}