aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pureJava/FinallyAndReturns.java
blob: db25b82ae82340b8fbcc9a7053cb914a4ece3df0 (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
import org.aspectj.testing.Tester;

public class FinallyAndReturns {
    public static void main(String[] args) {
        Tester.checkEqual(m(), "hi");
        Tester.check("finally");

        Tester.checkEqual(m1(), "hi1");
        Tester.check("trying");
    }

    public static String m() {
        try {
            return "hi";
        } finally {
            Tester.note("finally");
        }
    }

    public static String m1() {
        try {
            Tester.note("trying");
        } finally {
            return "hi1";
        }
    }

}