|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TryCatchBlock
Allows a portion of a method to be marked so that exception and finally handlers can be provided.
InstructionBuilder.startTryCatch(TryCatchCallback)
Method Summary | |
---|---|
void |
addCatch(String exceptionClassName,
InstructionBuilderCallback callback)
Ends the block (if not already ended) and inserts a catch block for the named exception. |
void |
addFinally(InstructionBuilderCallback callback)
As with addCatch(String, InstructionBuilderCallback) , but the exception caught is
null, which acts as a finally block in the Java language. |
void |
addTry(InstructionBuilderCallback callback)
Invoked first, to generate the code in which exceptions may be caught. |
Method Detail |
---|
void addTry(InstructionBuilderCallback callback)
@Opcodes(value="TRYCATCHBLOCK") void addCatch(String exceptionClassName, InstructionBuilderCallback callback)
addTry(InstructionBuilderCallback)
.
Note: no attempt is made currently to sort the handlers; for example adding a catch for java.lang.Exception first will mean that more specific exception handlers added later will never be invoked.
exceptionClassName
- caught exception classcallback
- that implements the logic of the catch block@Opcodes(value="TRYCATCHBLOCK") void addFinally(InstructionBuilderCallback callback)
addCatch(String, InstructionBuilderCallback)
, but the exception caught is
null, which acts as a finally block in the Java language. This must be called last (after
addTry(InstructionBuilderCallback)
and any calls to
addCatch(String, InstructionBuilderCallback)
.
callback
- implements the logic of the finally block
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |