| java.lang.Object EDU.purdue.cs.bloat.editor.MethodEditor
Inner Class :class LineNumberEntry | |
Inner Class :class LocalInfo | |
Inner Class :class LocalVarEntry | |
Constructor Summary | |
public | MethodEditor(ClassEditor editor, int modifiers, Class returnType, String methodName, Class[] paramTypes, Class[] exceptionTypes) | public | MethodEditor(ClassEditor editor, int modifiers, Type returnType, String methodName, Type[] paramTypes, Type[] exceptionTypes) Creates a new MethodEditor for editing a method in a given
class with the given modifiers, return type, name, parameter types, and
exception types.
Parameters: modifiers - The EDU.purdue.cs.bloat.reflect.Modifiers modifiersfor the new method Parameters: returnType - The return type of the method. | public | MethodEditor(ClassEditor editor, MethodInfo methodInfo) Constructor. |
OPT_STACK_2 | public static boolean OPT_STACK_2(Code) | | |
PRESERVE_DEBUG | public static boolean PRESERVE_DEBUG(Code) | | |
UNIQUE_HANDLERS | public static boolean UNIQUE_HANDLERS(Code) | | |
MethodEditor | public MethodEditor(ClassEditor editor, int modifiers, Type returnType, String methodName, Type[] paramTypes, Type[] exceptionTypes)(Code) | | Creates a new MethodEditor for editing a method in a given
class with the given modifiers, return type, name, parameter types, and
exception types.
Parameters: modifiers - The EDU.purdue.cs.bloat.reflect.Modifiers modifiersfor the new method Parameters: returnType - The return type of the method. If, returnType is null, the return type is assumed to be void . Parameters: methodName - The name of the method Parameters: paramTypes - The types of the parameters to the new method. IfparamTypes is null , then weassume that there are no arguments. Parameters: exceptionTypes - The types of exceptions that may be thrown by the new method.If exceptionTypes is null , thenwe assume that no exceptions are declared. |
addInstruction | public void addInstruction(int opcodeClass)(Code) | | Add an instruction.
Parameters: opcodeClass - The instruction to add. |
addInstruction | public void addInstruction(int opcodeClass, Object operand)(Code) | | Add an instruction.
Parameters: opcodeClass - The instruction to add. |
addInstruction | public void addInstruction(Instruction inst)(Code) | | Add an instruction to the end of the code array.
Parameters: inst - The instruction to add. throws: IllegalStateException - This field has been marked for deletion |
addLabel | public void addLabel(Label label)(Code) | | Add a label to the code array to the end of the code array.
Parameters: label - The label to add. throws: IllegalStateException - This field has been marked for deletion |
addLineNumberEntry | public void addLineNumberEntry(Label label, int lineNumber)(Code) | | Add a line number entry.
Parameters: label - The label beginning the range of instructions for this linenumber. Parameters: lineNumber - The line number. throws: IllegalStateException - This field has been marked for deletion |
addTryCatch | public void addTryCatch(TryCatch tryCatch)(Code) | | Add an exception handler.
Parameters: tryCatch - An exception handler. throws: IllegalStateException - This field has been marked for deletion |
clearCode | public void clearCode()(Code) | | Remove all the instructions in preparation for the instructions being
added back after a control flow graph edit.
throws: IllegalStateException - This field has been marked for deletion |
clearCode2 | public void clearCode2()(Code) | | Like clear code, but doesn't reset the maxLocals. I'm not really sure why
this works, but it stops certain parts of code that is generated and then
re-cfg'd from being eliminated as dead
|
code | public List code()(Code) | | Returns the code (Instructions and Labels) in
the method.
|
codeElementAt | public Object codeElementAt(int i)(Code) | | Returns a Label or Instruction in the code array.
Parameters: i - The index into the code array. The element at the index. |
codeLength | public int codeLength()(Code) | | Get the length of the code array.
The length of the code array. |
commit | public void commit()(Code) | | Commits changes made to this MethodEditor back to the MethodInfo on which
it is based. Note that committal will take place regardless of whether or
not the method is dirty.
|
declaringClass | public ClassEditor declaringClass()(Code) | | Returns the class which declared the method.
|
delete | public void delete()(Code) | | Marks this method for deletion. Once a method has been marked for
deletion all attempts to change it will throw an
IllegalStateException .
|
equals | public boolean equals(Object o)(Code) | | Two MethodEditors are equal if they edit the same method in
the same class.
|
exceptions | public Type[] exceptions()(Code) | | Returns the Types of exceptions that this method may throw.
|
firstBlock | public Label firstBlock()(Code) | | Get the label of the first block.
|
hashCode | public int hashCode()(Code) | | A MethodEditor's hash code is based on the hash codes for its
class, name, and type.
|
insertCodeAt | public void insertCodeAt(Object obj, int i)(Code) | | Inserts a Label or Instruction into the code array.
Parameters: i - The index of the element to insert before. throws: IllegalStateException - This field has been marked for deletion |
isAbstract | public boolean isAbstract()(Code) | | |
isConstructor | public boolean isConstructor()(Code) | | Returns true if the method being edited is a constructor.
|
isDirty | public boolean isDirty()(Code) | | Returns true if this method has been modified.
|
isFinal | public boolean isFinal()(Code) | | |
isInterface | public boolean isInterface()(Code) | | Returns true if this method's class is an interface.
|
isNative | public boolean isNative()(Code) | | |
isPackage | public boolean isPackage()(Code) | | Returns true is the method has package level visibility
|
isPrivate | public boolean isPrivate()(Code) | | |
isProtected | public boolean isProtected()(Code) | | |
isPublic | public boolean isPublic()(Code) | | |
isStatic | public boolean isStatic()(Code) | | |
isSynchronized | public boolean isSynchronized()(Code) | | |
localAt | public LocalVariable localAt(int index)(Code) | | Returns the LocalVariable with the given index. If there is no
local variable at that index, a new one is created at that index. We
assume that this variable is not wide.
|
maxLocals | public int maxLocals()(Code) | | Returns the maximum number of locals used by the method.
|
memberRef | public MemberRef memberRef()(Code) | | Returns a MemberRef for the method.
|
methodInfo | public MethodInfo methodInfo()(Code) | | Returns the raw MethodInfo of the method being edited.
|
name | public String name()(Code) | | Returns the name of the method.
|
nameAndType | public NameAndType nameAndType()(Code) | | Returns the NameAndType of the method.
|
newLabel | public Label newLabel()(Code) | | Get the next available label. That is the Label after the final
Instruction in the code array.
A new label. throws: IllegalStateException - This field has been marked for deletion |
nextBlock | public Label nextBlock(Label label)(Code) | | Get the label of the next block after the parameter.
Parameters: label - The label at which to begin. The label. |
numTryCatches | public int numTryCatches()(Code) | | Returns the number of exception handlers in the method.
|
paramAt | public LocalVariable paramAt(int index)(Code) | | Get the LocalVariable for the parameter at the given index.
Parameters: index - The index into the params (0 is the this pointer or the firstargument, if static). The LocalVariable for the parameter at the given index. |
paramTypes | public Type[] paramTypes()(Code) | | Returns an array of Types representing the types of the
parameters of this method. It's really used to figure out the type of the
local variables that hold the parameters. So, wide data is succeeded by
an empty slot. Also, for virtual methods, the first element in the array
is the receiver.
|
print | public void print(PrintStream out)(Code) | | Print the method.
Parameters: out - Stream to which to print. |
removeCodeAt | public void removeCodeAt(int i)(Code) | | Removes a Label or Instruction from the code array.
Parameters: i - The index of the element to remove. throws: IllegalStateException - This field has been marked for deletion |
replaceCodeAt | public void replaceCodeAt(Object obj, int i)(Code) | | Replace a Label or Instruction in the code array.
Parameters: obj - The new element. Parameters: i - The index of the element to replace throws: IllegalStateException - This field has been marked for deletion |
setAbstract | public void setAbstract(boolean flag)(Code) | | |
setDirty | public void setDirty(boolean dirty)(Code) | | Sets the dirty flag of this method. The dirty flag is true if
the method has been modified.
|
tryCatches | public Collection tryCatches()(Code) | | Returns the exception handlers (TryCatch) in the method.
|
type | public Type type()(Code) | | Returns the type of the method.
|
|
|