public class TryCatchBlockImpl extends Lockable implements TryCatchBlock
Modifier and Type | Method and Description |
---|---|
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
TryCatchBlock.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.
|
public void addTry(InstructionBuilderCallback callback)
TryCatchBlock
addTry
in interface TryCatchBlock
public void addCatch(String exceptionClassName, InstructionBuilderCallback callback)
TryCatchBlock
TryCatchBlock.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.addCatch
in interface TryCatchBlock
exceptionClassName
- caught exception classcallback
- that implements the logic of the catch blockpublic void addFinally(InstructionBuilderCallback callback)
TryCatchBlock
TryCatchBlock.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
TryCatchBlock.addTry(InstructionBuilderCallback)
and any calls to
TryCatchBlock.addCatch(String, InstructionBuilderCallback)
.addFinally
in interface TryCatchBlock
callback
- implements the logic of the finally block5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.