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 InstructionHandle
EMPTY_ARRAY, i_positionModifier and TypeFieldDescriptionstatic final InstructionHandle[]Empty array.protected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
Method Summary
Modifier and TypeMethodDescriptionintGets the position.Gets the target of instruction.voidSets new contents.voidSets the target of the instruction.protected intupdatePosition(int offset, int maxOffset) Called by InstructionList.setPositions when setting the position for every instruction.voidupdateTarget(InstructionHandle oldIh, InstructionHandle newIh) Update target of instruction.Methods inherited from class InstructionHandle
accept, addAttribute, addHandle, addTargeter, getAttribute, getAttributes, getInstruction, getNext, getPrev, getTargeters, hasTargeters, removeAllTargeters, removeAttribute, removeTargeter, swapInstruction, toString, toStringModifier and TypeMethodDescriptionvoidConvenience method, simply calls accept() on the contained instruction.voidaddAttribute(Object key, Object attr) Add an attribute to an instruction handle.protected voidDeprecated.Does nothing as of 6.3.1.voidDenote this handle is being referenced by t.getAttribute(Object key) Gets an attribute of an instruction handle.Gets all attributes associated with this handle.final InstructionGets the instruction.final InstructionHandlegetNext()Gets the next instruction handle.final InstructionHandlegetPrev()Gets the previous instruction handle.Gets the targeters.booleanTests whether this handle has targeters.voidRemove all targeters, if any.voidremoveAttribute(Object key) Delete an attribute of an instruction handle.voidDenote this handle isn't referenced anymore by t.Temporarily swap the current instruction, without disturbing anything.toString()Gets a string representation of the contained instruction.toString(boolean verbose) Gets a verbose string representation of the contained instruction.
-
Method Details
-
getPosition
Description copied from class:InstructionHandleGets the position.- Overrides:
getPositionin classInstructionHandle- Returns:
- The position, the byte code offset of the contained instruction. This is accurate only after InstructionList.setPositions() has been called.
-
getTarget
Gets the target of instruction.- Returns:
- target of instruction.
-
setInstruction
Sets new contents. Old instruction is disposed and may not be used anymore.- Overrides:
setInstructionin classInstructionHandle- Parameters:
i- The new instruction.
-
setTarget
Sets the target of the instruction.- Parameters:
ih- The new target.
-
updatePosition
Description copied from class:InstructionHandleCalled 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:
updatePositionin classInstructionHandle- Parameters:
offset- additional offset caused by preceding (variable length) instructions.maxOffset- 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.- Parameters:
oldIh- The old instruction handle.newIh- The new instruction handle.
-