Class MethodEditor.Visitor
java.lang.Object
com.ibm.wala.shrike.shrikeBT.IInstruction.Visitor
com.ibm.wala.shrike.shrikeBT.MethodEditor.Visitor
- Enclosing class:
MethodEditor
A specialized Instruction.Visitor providing convenience methods for inserting patches. In
particular it maintains a notion of the "current position" in the code array.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
addInstructionExceptionHandler
(String catchClass, MethodEditor.Patch p) Add an exception handler to the current instruction.final int
getIndex()
final void
Insert a patch after the current instruction in the code.final void
Insert a patch before the current instruction in the code.final void
Replace the current instruction in the code with a patch.final void
setIndex
(MethodEditor e, int i) Set the current editor and instruction index for this visitor.Methods inherited from class com.ibm.wala.shrike.shrikeBT.IInstruction.Visitor
visitArrayLength, visitArrayLoad, visitArrayStore, visitBinaryOp, visitCheckCast, visitComparison, visitConditionalBranch, visitConstant, visitConversion, visitDup, visitGet, visitGoto, visitInstanceof, visitInvoke, visitLoadIndirect, visitLocalLoad, visitLocalStore, visitMonitor, visitNew, visitPop, visitPut, visitReturn, visitShift, visitStoreIndirect, visitSwap, visitSwitch, visitThrow, visitUnaryOp
-
Constructor Details
-
Visitor
public Visitor()
-
-
Method Details
-
setIndex
Set the current editor and instruction index for this visitor. -
getIndex
public final int getIndex()- Returns:
- the index of the current instruction in the code array
-
insertAfter
Insert a patch after the current instruction in the code. -
insertBefore
Insert a patch before the current instruction in the code. -
replaceWith
Replace the current instruction in the code with a patch. -
addInstructionExceptionHandler
Add an exception handler to the current instruction.- Parameters:
catchClass
- the JVM type for the exception to be caught (e.g., Ljava.io.IOException;), or null to catch all exceptionsp
- the code to handle the exception
-