关于Gen生成try-catch-finally
Posted extjs4
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于Gen生成try-catch-finally相关的知识,希望对你有一定的参考价值。
class TestExc extends Exception{} void tryItOut () throws TestExc{} void handleExc(Object o){} void catchOne() { try { tryItOut(); } catch (TestExc e) { handleExc(e); } }
public class com.test19.Test04 SourceFile: "Test04.java" InnerClasses: #7= #3 of #5; //TestExc=class com/test19/Test04$TestExc of class com/test 19/Test04 minor version: 0 major version: 51 flags: ACC_PUBLIC, ACC_SUPER Constant pool: #1 = Methodref #6.#29 // java/lang/Object."<init>":()V #2 = Methodref #5.#30 // com/test19/Test04.tryItOut:()V #3 = Class #31 // com/test19/Test04$TestExc #4 = Methodref #5.#32 // com/test19/Test04.handleExc:(Ljava /lang/Object;)V #5 = Class #33 // com/test19/Test04 #6 = Class #34 // java/lang/Object #7 = Utf8 TestExc #8 = Utf8 InnerClasses #9 = Utf8 <init> #10 = Utf8 ()V #11 = Utf8 Code #12 = Utf8 LineNumberTable #13 = Utf8 LocalVariableTable #14 = Utf8 this #15 = Utf8 Lcom/test19/Test04; #16 = Utf8 tryItOut #17 = Utf8 Exceptions #18 = Utf8 handleExc #19 = Utf8 (Ljava/lang/Object;)V #20 = Utf8 o #21 = Utf8 Ljava/lang/Object; #22 = Utf8 catchOne #23 = Utf8 e #24 = Utf8 Lcom/test19/Test04$TestExc; #25 = Utf8 StackMapTable #26 = Class #31 // com/test19/Test04$TestExc #27 = Utf8 SourceFile #28 = Utf8 Test04.java #29 = NameAndType #9:#10 // "<init>":()V #30 = NameAndType #16:#10 // tryItOut:()V #31 = Utf8 com/test19/Test04$TestExc #32 = NameAndType #18:#19 // handleExc:(Ljava/lang/Object;)V #33 = Utf8 com/test19/Test04 #34 = Utf8 java/lang/Object { public com.test19.Test04(); flags: ACC_PUBLIC Code: stack=1, locals=1, args_size=1 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init> ":()V 4: return LineNumberTable: line 2: 0 line 20: 4 LocalVariableTable: Start Length Slot Name Signature 0 5 0 this Lcom/test19/Test04; void tryItOut() throws com.test19.Test04$TestExc; flags: Code: stack=0, locals=1, args_size=1 0: return LineNumberTable: line 21: 0 LocalVariableTable: Start Length Slot Name Signature 0 1 0 this Lcom/test19/Test04; Exceptions: throws com.test19.Test04$TestExc void handleExc(java.lang.Object); flags: Code: stack=0, locals=2, args_size=2 0: return LineNumberTable: line 22: 0 LocalVariableTable: Start Length Slot Name Signature 0 1 0 this Lcom/test19/Test04; 0 1 1 o Ljava/lang/Object; void catchOne(); flags: Code: stack=2, locals=2, args_size=1 0: aload_0 1: invokevirtual #2 // Method tryItOut:()V 4: goto 13 7: astore_1 8: aload_0 9: aload_1 10: invokevirtual #4 // Method handleExc:(Ljava/lang/Ob ject;)V 13: return Exception table: from to target type 0 4 7 Class com/test19/Test04$TestExc LineNumberTable: line 26: 0 line 29: 4 line 27: 7 line 28: 8 line 30: 13 LocalVariableTable: Start Length Slot Name Signature 8 5 1 e Lcom/test19/Test04$TestExc; 0 14 0 this Lcom/test19/Test04; StackMapTable: number_of_entries = 2 frame_type = 71 /* same_locals_1_stack_item */ stack = [ class com/test19/Test04$TestExc ] frame_type = 5 /* same */ }
2A B6 00 02 A7 00 09 4C 2A 2B B6 00 04 B1 opcode [2A] - 0000: aload_0 opcode [B6] - 0001: invokevirtual 2 [Methodref: com.test19.Test04.tryItOut, parameter = (), returns = void] opcode [A7] - 0004: goto 9 opcode [4C] - 0007: astore_1 opcode [2A] - 0008: aload_0 opcode [2B] - 0009: aload_1 opcode [B6] - 0010: invokevirtual 4 [Methodref: com.test19.Test04.handleExc, parameter = (java.lang.Object), returns = void] opcode [B1] - 0013: return
以上是关于关于Gen生成try-catch-finally的主要内容,如果未能解决你的问题,请参考以下文章
[转]JVM内存区域划分Eden SpaceSurvivor SpaceTenured Gen,Perm Gen解释
JVM内存区域划分Eden Space,Survivor Space,Tenured Gen,Perm Gen
312. 在Java中,关于捕获异常的语法try-catch-finally的下列描述正确的是哪个项目?(选择2项)