1 2method A.<init>():void 3{ 4 .src "tryCatch.java" 5 .line 2 6 .prologue_end 7 .line 2 8 0| move-object v0, v2 9 .local v0, "this", A 10 1| move-object v1, v0 11 2| invoke-direct {v1}, java.lang.Throwable.<init>():void 12 5| return-void 13} 14 15method B.<init>():void 16{ 17 .src "tryCatch.java" 18 .line 6 19 .prologue_end 20 .line 6 21 0| move-object v0, v2 22 .local v0, "this", B 23 1| move-object v1, v0 24 2| invoke-direct {v1}, java.lang.Throwable.<init>():void 25 5| return-void 26} 27 28method TryCatch.<init>():void 29{ 30 .src "tryCatch.java" 31 .line 10 32 .prologue_end 33 .line 10 34 0| move-object v0, v2 35 .local v0, "this", TryCatch 36 1| move-object v1, v0 37 2| invoke-direct {v1}, java.lang.Object.<init>():void 38 5| return-void 39} 40 41method TryCatch.foo(int):int 42{ 43 .params "?" 44 .src "tryCatch.java" 45 .line 27 46 .prologue_end 47 .line 27 48 0| move v0, v4 49 .local v0, "x", int 50 1| move v1, v0 51 2| if-lez v1, Label_4 52 .line 28 53 4| move v1, v0 54 5| packed-switch v1, Label_5 55 .line 31 56 8| const/4 v1, #+1 (0x00000001 | 1.40130e-45) 57 9| move v0, v1 58Label_1: 59 .line 34 60 .end_local v0 61 10| return v0 62Label_2: 63 .line 29 64 .restart_local v0 65 11| new-instance v1, A 66 13| move-object v3, v1 67 14| move-object v1, v3 68 15| move-object v2, v3 69 16| invoke-direct {v2}, A.<init>():void 70 19| throw v1 71Label_3: 72 .line 30 73 20| new-instance v1, B 74 22| move-object v3, v1 75 23| move-object v1, v3 76 24| move-object v2, v3 77 25| invoke-direct {v2}, B.<init>():void 78 28| throw v1 79Label_4: 80 .line 34 81 29| const/4 v1, #+0 (0x00000000 | 0.00000) 82 30| move v0, v1 83 31| goto/16 Label_1 84 33| nop 85Label_5: <aligned> 86 .line 28 87 34| packed-switch-payload 88 1: Label_2 89 2: Label_3 90} 91 92method TryCatch.main(java.lang.String[]):void 93{ 94 .params "?" 95 .src "tryCatch.java" 96 .line 15 97 .prologue_end 98 .line 15 99 0| move-object v0, v6 100 .local v0, "args", java.lang.String[] 101 1| const/4 v3, #+0 (0x00000000 | 0.00000) 102 .try_begin_1 103 2| invoke-static {v3}, TryCatch.foo(int):int 104 .try_end_1 105 catch(B) : Label_3 106 catch(A) : Label_4 107 catch(...) : Label_5 108 5| move-result v3 109Label_1: 110 .line 18 111 .line 22 112 6| sget-object v3, java.lang.System.out 113 8| const-string v4, "finally\n" 114 10| const/4 v5, #+0 (0x00000000 | 0.00000) 115 11| new-array v5, v5, java.lang.Object[] 116 13| invoke-virtual {v3,v4,v5}, java.io.PrintStream.printf(java.lang.String, java.lang.Object[]):java.io.PrintStream 117 16| move-result-object v3 118Label_2: 119 .line 23 120 .line 24 121 17| return-void 122Label_3: 123 .line 16 124 18| move-exception v3 125 19| move-object v1, v3 126 .try_begin_2 127 .line 17 128 .local v1, "ex", B 129 20| sget-object v3, java.lang.System.out 130 22| const-string v4, "catch: B\n" 131 24| const/4 v5, #+0 (0x00000000 | 0.00000) 132 25| new-array v5, v5, java.lang.Object[] 133 27| invoke-virtual {v3,v4,v5}, java.io.PrintStream.printf(java.lang.String, java.lang.Object[]):java.io.PrintStream 134 .try_end_2 135 catch(A) : Label_4 136 catch(...) : Label_5 137 30| move-result-object v3 138 31| goto/16 Label_1 139Label_4: 140 .line 19 141 .end_local v1 142 33| move-exception v3 143 34| move-object v1, v3 144 .try_begin_3 145 .line 20 146 .local v1, "ex", A 147 35| sget-object v3, java.lang.System.out 148 37| const-string v4, "catch: A\n" 149 39| const/4 v5, #+0 (0x00000000 | 0.00000) 150 40| new-array v5, v5, java.lang.Object[] 151 42| invoke-virtual {v3,v4,v5}, java.io.PrintStream.printf(java.lang.String, java.lang.Object[]):java.io.PrintStream 152 .try_end_3 153 catch(...) : Label_5 154 45| move-result-object v3 155 .line 22 156 46| sget-object v3, java.lang.System.out 157 48| const-string v4, "finally\n" 158 50| const/4 v5, #+0 (0x00000000 | 0.00000) 159 51| new-array v5, v5, java.lang.Object[] 160 53| invoke-virtual {v3,v4,v5}, java.io.PrintStream.printf(java.lang.String, java.lang.Object[]):java.io.PrintStream 161 56| move-result-object v3 162 .line 23 163 57| goto/16 Label_2 164Label_5: 165 .line 22 166 .end_local v1 167 59| move-exception v3 168 60| move-object v2, v3 169 61| sget-object v3, java.lang.System.out 170 63| const-string v4, "finally\n" 171 65| const/4 v5, #+0 (0x00000000 | 0.00000) 172 66| new-array v5, v5, java.lang.Object[] 173 68| invoke-virtual {v3,v4,v5}, java.io.PrintStream.printf(java.lang.String, java.lang.Object[]):java.io.PrintStream 174 71| move-result-object v3 175 72| move-object v3, v2 176 73| throw v3 177} 178