Package org.apache.bcel.generic
Class BranchHandle
java.lang.Object
org.apache.bcel.generic.InstructionHandle
org.apache.bcel.generic.BranchHandle
BranchHandle is returned by specialized InstructionList.append() whenever a BranchInstruction is appended. This is
useful when the target of this instruction is not known at time of creation and must be set later via setTarget().
- See Also:
-
Field Summary
Fields inherited from class org.apache.bcel.generic.InstructionHandle
EMPTY_ARRAY, i_position
-
Method Summary
Modifier and TypeMethodDescriptionint
void
Sets new contents.void
Pass new target to instruction.protected int
updatePosition
(int offset, int maxOffset) Called by InstructionList.setPositions when setting the position for every instruction.void
updateTarget
(InstructionHandle oldIh, InstructionHandle newIh) Update target of instruction.Methods inherited from class org.apache.bcel.generic.InstructionHandle
accept, addAttribute, addHandle, addTargeter, getAttribute, getAttributes, getInstruction, getNext, getPrev, getTargeters, hasTargeters, removeAllTargeters, removeAttribute, removeTargeter, swapInstruction, toString, toString
-
Method Details
-
getPosition
- Overrides:
getPosition
in classInstructionHandle
- Returns:
- the position, i.e., the byte code offset of the contained instruction. This is accurate only after InstructionList.setPositions() has been called.
-
getTarget
- Returns:
- target of instruction.
-
setInstruction
Sets new contents. Old instruction is disposed and may not be used anymore.- Overrides:
setInstruction
in classInstructionHandle
-
setTarget
Pass new target to instruction. -
updatePosition
Description copied from class:InstructionHandle
Called by InstructionList.setPositions when setting the position for every instruction. In the presence of variable length instructions 'setPositions()' performs multiple passes over the instruction list to calculate the correct (byte) positions and offsets by calling this function.- Overrides:
updatePosition
in classInstructionHandle
- Parameters:
offset
- additional offset caused by preceding (variable length) instructionsmaxOffset
- the maximum offset that may be caused by these instructions- Returns:
- additional offset caused by possible change of this instruction's length
-
updateTarget
Update target of instruction.
-