com.ibm.wala.shrikeBT
Class MethodEditor.Visitor

java.lang.Object
  extended by com.ibm.wala.shrikeBT.Instruction.Visitor
      extended by com.ibm.wala.shrikeBT.MethodEditor.Visitor
Enclosing class:
MethodEditor

public static class MethodEditor.Visitor
extends Instruction.Visitor

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
MethodEditor.Visitor()
           
 
Method Summary
 void addInstructionExceptionHandler(java.lang.String catchClass, MethodEditor.Patch p)
          Add an exception handler to the current instruction.
 int getIndex()
           
 void insertAfter(MethodEditor.Patch p)
          Insert a patch after the current instruction in the code.
 void insertBefore(MethodEditor.Patch p)
          Insert a patch before the current instruction in the code.
 void replaceWith(MethodEditor.Patch p)
          Replace the current instruction in the code with a patch.
 void setIndex(MethodEditor e, int i)
          Set the current editor and instruction index for this visitor.
 
Methods inherited from class com.ibm.wala.shrikeBT.Instruction.Visitor
visitArrayLength, visitArrayLoad, visitArrayStore, visitBinaryOp, visitCheckCast, visitComparison, visitConditionalBranch, visitConstant, visitConversion, visitDup, visitGet, visitGoto, visitInstanceof, visitInvoke, visitLocalLoad, visitLocalStore, visitMonitor, visitNew, visitPop, visitPut, visitReturn, visitShift, visitSwap, visitSwitch, visitThrow, visitUnaryOp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodEditor.Visitor

public MethodEditor.Visitor()
Method Detail

setIndex

public final void setIndex(MethodEditor e,
                           int i)
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

public final void insertAfter(MethodEditor.Patch p)
Insert a patch after the current instruction in the code.


insertBefore

public final void insertBefore(MethodEditor.Patch p)
Insert a patch before the current instruction in the code.


replaceWith

public final void replaceWith(MethodEditor.Patch p)
Replace the current instruction in the code with a patch.


addInstructionExceptionHandler

public final void addInstructionExceptionHandler(java.lang.String catchClass,
                                                 MethodEditor.Patch p)
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 exceptions
p - the code to handle the exception