xref: /aosp_15_r20/dalvik/dx/tests/115-merge/testdata/TryCatchFinally.java (revision 055d459012065f78d96b68be8421640240ddf631)
1*055d4590SKeyi Gui package testdata;
2*055d4590SKeyi Gui 
3*055d4590SKeyi Gui public class TryCatchFinally {
4*055d4590SKeyi Gui 
method()5*055d4590SKeyi Gui     public static void method() {
6*055d4590SKeyi Gui         int count = 0;
7*055d4590SKeyi Gui         try {
8*055d4590SKeyi Gui             if (true) {
9*055d4590SKeyi Gui                 throw new NullPointerException();
10*055d4590SKeyi Gui             }
11*055d4590SKeyi Gui             throw new AssertionError();
12*055d4590SKeyi Gui         } catch (IllegalStateException e) {
13*055d4590SKeyi Gui             throw new AssertionError();
14*055d4590SKeyi Gui         } catch (NullPointerException expected) {
15*055d4590SKeyi Gui             count++;
16*055d4590SKeyi Gui         } catch (RuntimeException e) {
17*055d4590SKeyi Gui             throw new AssertionError();
18*055d4590SKeyi Gui         } finally {
19*055d4590SKeyi Gui             count++;
20*055d4590SKeyi Gui         }
21*055d4590SKeyi Gui 
22*055d4590SKeyi Gui         if (count != 2) {
23*055d4590SKeyi Gui             throw new AssertionError();
24*055d4590SKeyi Gui         }
25*055d4590SKeyi Gui     }
26*055d4590SKeyi Gui }
27