exception_table array
of a Code attribute. Catch (JVMS 3.12) and
finally (JVMS 3.14) blocks in Java source code compile to exception
table entries. The order of exception table entries is significant: when an
exception is thrown in a method, execution branches to the first matching
exception handler if such a handler exists (JVMS 2.10). Delivered as
a CodeElement when traversing the contents of a CodeModel.
An exception table entry is composite:
ExceptionCatch( Label handler, Label tryStart, Label tryEnd, Optional<ClassEntry> catchType )
Code Attribute
CodeBuilder::exceptionCatch, CodeAttribute#exceptionHandlers()
| Modifier and Type | Method and Description |
|---|---|
| public Optional | Returns: the type of the exception to catch, or empty if this handler catches everythingReturns the type of the exception to catch, or empty if this handler catches everything. |
| public Label | |
| public static ExceptionCatch | Returns: an exception table pseudo-instructionthe handler for the exception handler, Label the beginning of the instruction range for the guarded instructions tryStart, Label the end of the instruction range for the guarded instructions tryEnd, Optional<ClassEntry> the type of exception to catch, or empty if this
handler is unconditional catchTypeEntry)Returns an exception table pseudo-instruction. |
| public static ExceptionCatch | Returns: an exception table pseudo-instruction to catch everythingthe handler for the exception handler, Label the beginning of the instruction range for the guarded instructions tryStart, Label the end of the instruction range for the guarded instructions tryEnd)Returns an exception table pseudo-instruction to catch everything. |
| public Label | Returns: the end of the instruction range for the guarded instructionsReturns the end of the instruction range for the guarded instructions. |
| public Label | Returns: the beginning of the instruction range for the guarded instructionsReturns the beginning of the instruction range for the guarded instructions. |
| catchType | back to summary |
|---|---|
| public Optional Returns the type of the exception to catch, or empty if this handler catches everything.
| |
| handler | back to summary |
|---|---|
| public Label handler() Returns the handler for the exception.
| |
| of | back to summary |
|---|---|
| public static ExceptionCatch of(Label handler, Label tryStart, Label tryEnd, Optional<ClassEntry> catchTypeEntry) Returns an exception table pseudo-instruction.
| |
| of | back to summary |
|---|---|
| public static ExceptionCatch of(Label handler, Label tryStart, Label tryEnd) Returns an exception table pseudo-instruction to catch everything.
| |
| tryEnd | back to summary |
|---|---|
| public Label tryEnd() Returns the end of the instruction range for the guarded instructions.
| |
| tryStart | back to summary |
|---|---|
| public Label tryStart() Returns the beginning of the instruction range for the guarded instructions.
| |