Package org.apache.bcel.generic
Class CodeExceptionGen
java.lang.Object
org.apache.bcel.generic.CodeExceptionGen
- All Implemented Interfaces:
Cloneable
,InstructionTargeter
This class represents an exception handler, i.e., specifies the region where
a handler is active and an instruction where the actual handling is done.
pool as parameters. Opposed to the JVM specification the end of the handled
region is set to be inclusive, i.e. all instructions between start and end
are protected including the start and end instructions (handles) themselves.
The end of the region is automatically mapped to be exclusive when calling
getCodeException(), i.e., there is no difference semantically.
- See Also:
-
Constructor Summary
ConstructorDescriptionCodeExceptionGen
(InstructionHandle startPc, InstructionHandle endPc, InstructionHandle handlerPc, ObjectType catchType) Add an exception handler, i.e., specify region where a handler is active and an instruction where the actual handling is done. -
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
Checks whether this targeter targets the specified instruction handle.Gets the type of the Exception to catch, 'null' for ANY.Get CodeException object.
This relies on that the instruction list has already been dumped to byte code or or that the `setPositions' methods has been called for the instruction list.getEndPC()
void
setCatchType
(ObjectType catchType) Sets the type of the Exception to catch.void
setEndPC
(InstructionHandle end_pc) void
setHandlerPC
(InstructionHandle handler_pc) void
setStartPC
(InstructionHandle start_pc) toString()
void
updateTarget
(InstructionHandle old_ih, InstructionHandle new_ih) Replaces the target of this targeter from this old handle to the new handle.
-
Constructor Details
-
CodeExceptionGen
public CodeExceptionGen(InstructionHandle startPc, InstructionHandle endPc, InstructionHandle handlerPc, ObjectType catchType) Add an exception handler, i.e., specify region where a handler is active and an instruction where the actual handling is done.- Parameters:
startPc
- Start of handled region (inclusive)endPc
- End of handled region (inclusive)handlerPc
- Where handling is donecatchType
- which exception is handled, null for ANY
-
-
Method Details
-
getCodeException
Get CodeException object.
This relies on that the instruction list has already been dumped to byte code or or that the `setPositions' methods has been called for the instruction list.- Parameters:
cp
- constant pool
-
setStartPC
-
setEndPC
-
setHandlerPC
-
updateTarget
Description copied from interface:InstructionTargeter
Replaces the target of this targeter from this old handle to the new handle.- Specified by:
updateTarget
in interfaceInstructionTargeter
- Parameters:
old_ih
- old target, either start or endnew_ih
- new target
-
containsTarget
Description copied from interface:InstructionTargeter
Checks whether this targeter targets the specified instruction handle.- Specified by:
containsTarget
in interfaceInstructionTargeter
- Returns:
- true, if ih is target of this handler
-
setCatchType
Sets the type of the Exception to catch. Set 'null' for ANY. -
getCatchType
Gets the type of the Exception to catch, 'null' for ANY. -
getStartPC
- Returns:
- start of handled region (inclusive)
-
getEndPC
- Returns:
- end of handled region (inclusive)
-
getHandlerPC
- Returns:
- start of handler
-
toString
-
clone
-