InstructionList, Method
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private List | |
| private ArrayList | |
| private ArrayList | |
| private boolean | |
| private boolean | |
| private int | |
| private InstructionList | |
| private List | |
| private List | |
| private int | |
| private int | |
| private List | |
| private String[] | |
| private Type[] | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | MethodGen(int
access qualifiers access_flags, Type method type return_type, Type[] argument types arg_types, String[] argument names (if this is null, default names will be provided for them) arg_names, String name of method method_name, String class name containing this method (may be null, if you don't care) class_name, InstructionList instruction list associated with this method, may be null only for abstract or native methods il, ConstantPool constant pool cp)Declare method. |
| public | MethodGen(Method
method m, String class name containing this method class_name, ConstantPool constant pool cp)Instantiate from existing method. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | addException(String
(fully qualified) name of exception class_name)Add an exception possibly thrown by this method. |
| public CodeExceptionGen | Returns: new exception handler objectStart of region (inclusive) start_pc, InstructionHandle End of region (inclusive) end_pc, InstructionHandle Where handling is done handler_pc, ObjectType class type of handled exception or null if any exception is handled catch_type)Add an exception handler, i.e., specify region where a handler is active and an instruction where the actual handling is done. |
| public LineNumberGen | Returns: new line number objectinstruction to tag ih, int src_line)Give an instruction a line number corresponding to the source code line. |
| public LocalVariableGen | |
| public LocalVariableGen | Returns: new local variable objectvariable name name, Type variable type type, InstructionHandle from where the variable is valid, if this is null, it is valid from the start start, InstructionHandle until where the variable is valid, if this is null, it is valid to the end end)Adds a local variable to this method and assigns an index automatically. |
| public void | |
| public void | |
| private void | ensureExistingParameterAnnotationsUnpacked()
Goes through the attributes on the method and identifies any that are RuntimeParameterAnnotations, extracting their contents and storing them as parameter annotations. |
| public List | getAnnotationsOnParameter(int i)
Return a list of AnnotationGen objects representing parameter annotations |
| public String | |
| public String[] | |
| public Type | |
| public Type[] | |
| public String | |
| public Attribute[] | |
| private CodeException[] | |
| public CodeExceptionGen[] | |
| public String[] | |
| private ExceptionTable | Returns: `Exceptions' attribute of all the exceptions thrown by this method.
|
| public int | |
| public InstructionList | |
| public LineNumberGen[] | |
| public LineNumberTable | Returns: 'LineNumberTable' attribute for all the local variables of this method.
|
| public LocalVariableGen[] | |
| public LocalVariableTable | Returns: `LocalVariableTable' attribute of all the local variables of this method.
|
| public int | |
| public int | |
| public static int | Returns: maximum stack depth used by methodComputes stack usage of an instruction list by performing control flow analysis. |
| public Method | |
| public Type | |
| public String | |
| private List | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | removeLocalVariable(LocalVariableGen l)
Remove a local variable, its slot will not be reused, if you do not use addLocalVariable with an explicit index argument. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setMaxLocals()
Compute maximum number of local variables based on the parameter count and bytecode usage of variables. |
| public void | setMaxLocals(boolean
if true and the local variable table indicates more are in use
than the code suggests, respect the higher value from the local variable table data. respectLocalVariableTable)Compute maximum number of local variables. |
| public void | |
| public void | |
| public void | |
| private static final void | |
| public void | |
| public final String | Returns: String representation of the method.Overrides java. |
| classname | back to summary |
|---|---|
| private String classname | |
| codeAttributesList | back to summary |
|---|---|
| private List<Attribute> codeAttributesList | |
| exceptionsList | back to summary |
|---|---|
| private ArrayList<CodeExceptionGen> exceptionsList | |
| exceptionsThrown | back to summary |
|---|---|
| private ArrayList<String> exceptionsThrown | |
| hasParameterAnnotations | back to summary |
|---|---|
| private boolean hasParameterAnnotations | |
| haveUnpackedParameterAnnotations | back to summary |
|---|---|
| private boolean haveUnpackedParameterAnnotations | |
| highestLineNumber | back to summary |
|---|---|
| private int highestLineNumber | |
| il | back to summary |
|---|---|
| private InstructionList il | |
| lineNumbersList | back to summary |
|---|---|
| private List<LineNumberGen> lineNumbersList | |
| localVariablesList | back to summary |
|---|---|
| private List<LocalVariableGen> localVariablesList | |
| maxLocals | back to summary |
|---|---|
| private int maxLocals | |
| maxStack | back to summary |
|---|---|
| private int maxStack | |
| param_annotations | back to summary |
|---|---|
| private List<AnnotationGen>[] param_annotations | |
| parameterNames | back to summary |
|---|---|
| private String[] parameterNames | |
| parameterTypes | back to summary |
|---|---|
| private Type[] parameterTypes | |
| stripAttributes | back to summary |
|---|---|
| private boolean stripAttributes | |
| MethodGen | back to summary |
|---|---|
| public MethodGen(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPool cp) Declare method. If the method is non-static the constructor automatically declares a local variable `$this' in slot 0. The actual code is contained in the `il' parameter, which may further manipulated by the user. But he must take care not to remove any instruction (handles) that are still referenced from this object. For example one may not add a local variable and later remove the instructions it refers to without causing havoc. It is safe however if you remove that local variable, too.
| |
| MethodGen | back to summary |
|---|---|
| public MethodGen(Method m, String class_name, ConstantPool cp) Instantiate from existing method.
| |
| MethodGen | back to summary |
|---|---|
| public MethodGen(Method m, String class_name, ConstantPool cp, boolean useTags) | |
| addCodeAttribute | back to summary |
|---|---|
| public void addCodeAttribute(Attribute a) Add an attribute to the code. Currently, the JVM knows about the LineNumberTable, LocalVariableTable and StackMap attributes, where the former two will be generated automatically and the latter is used for the MIDP only. Other attributes will be ignored by the JVM but do no harm.
| |
| addException | back to summary |
|---|---|
| public void addException(String class_name) Add an exception possibly thrown by this method.
| |
| addExceptionHandler | back to summary |
|---|---|
| public CodeExceptionGen addExceptionHandler(InstructionHandle start_pc, InstructionHandle end_pc, InstructionHandle handler_pc, ObjectType catch_type) Add an exception handler, i.e., specify region where a handler is active and an instruction where the actual handling is done.
| |
| addLineNumber | back to summary |
|---|---|
| public LineNumberGen addLineNumber(InstructionHandle ih, int src_line) Give an instruction a line number corresponding to the source code line.
| |
| addLocalVariable | back to summary |
|---|---|
| public LocalVariableGen addLocalVariable(String name, Type type, int slot, InstructionHandle start, InstructionHandle end) | |
| addLocalVariable | back to summary |
|---|---|
| public LocalVariableGen addLocalVariable(String name, Type type, InstructionHandle start, InstructionHandle end) Adds a local variable to this method and assigns an index automatically.
| |
| addParameterAnnotation | back to summary |
|---|---|
| public void addParameterAnnotation(int parameterIndex, AnnotationGen annotation) | |
| addParameterAnnotationsAsAttribute | back to summary |
|---|---|
| public void addParameterAnnotationsAsAttribute(ConstantPool cp) | |
| ensureExistingParameterAnnotationsUnpacked | back to summary |
|---|---|
| private void ensureExistingParameterAnnotationsUnpacked() Goes through the attributes on the method and identifies any that are RuntimeParameterAnnotations, extracting their contents and storing them as parameter annotations. There are two kinds of parameter annotation - visible and invisible. Once they have been unpacked, these attributes are deleted. (The annotations will be rebuilt as attributes when someone builds a Method object out of this MethodGen object). | |
| getAnnotationsOnParameter | back to summary |
|---|---|
| public List Return a list of AnnotationGen objects representing parameter annotations | |
| getArgumentName | back to summary |
|---|---|
| public String getArgumentName(int i) | |
| getArgumentNames | back to summary |
|---|---|
| public String[] getArgumentNames() | |
| getArgumentType | back to summary |
|---|---|
| public Type getArgumentType(int i) | |
| getArgumentTypes | back to summary |
|---|---|
| public Type[] getArgumentTypes() | |
| getClassName | back to summary |
|---|---|
public String getClassName()
| |
| getCodeAttributes | back to summary |
|---|---|
public Attribute[] getCodeAttributes()
| |
| getCodeExceptions | back to summary |
|---|---|
private CodeException[] getCodeExceptions()
| |
| getExceptionHandlers | back to summary |
|---|---|
| public CodeExceptionGen[] getExceptionHandlers() | |
| getExceptions | back to summary |
|---|---|
| public String[] getExceptions() | |
| getExceptionTable | back to summary |
|---|---|
private ExceptionTable getExceptionTable(ConstantPool cp)
| |
| getHighestlinenumber | back to summary |
|---|---|
| public int getHighestlinenumber() | |
| getInstructionList | back to summary |
|---|---|
| public InstructionList getInstructionList() | |
| getLineNumbers | back to summary |
|---|---|
| public LineNumberGen[] getLineNumbers() | |
| getLineNumberTable | back to summary |
|---|---|
public LineNumberTable getLineNumberTable(ConstantPool cp)
| |
| getLocalVariables | back to summary |
|---|---|
| public LocalVariableGen[] getLocalVariables() | |
| getLocalVariableTable | back to summary |
|---|---|
public LocalVariableTable getLocalVariableTable(ConstantPool cp)
| |
| getMaxLocals | back to summary |
|---|---|
| public int getMaxLocals() | |
| getMaxStack | back to summary |
|---|---|
| public int getMaxStack() | |
| getMaxStack | back to summary |
|---|---|
| public static int getMaxStack(ConstantPool cp, InstructionList il, CodeExceptionGen[] et) Computes stack usage of an instruction list by performing control flow analysis.
| |
| getMethod | back to summary |
|---|---|
| public Method getMethod() Get method object. Never forget to call setMaxStack() or setMaxStack(max), respectively, before calling this method (the same applies for max locals).
| |
| getReturnType | back to summary |
|---|---|
| public Type getReturnType() | |
| getSignature | back to summary |
|---|---|
| public String getSignature() Implements abstract org.
| |
| makeMutableVersion | back to summary |
|---|---|
| private List | |
| removeCodeAttribute | back to summary |
|---|---|
| public void removeCodeAttribute(Attribute a) Remove a code attribute. | |
| removeCodeAttributes | back to summary |
|---|---|
| public void removeCodeAttributes() Remove all code attributes. | |
| removeException | back to summary |
|---|---|
| public void removeException(String c) Remove an exception. | |
| removeExceptionHandler | back to summary |
|---|---|
| public void removeExceptionHandler(CodeExceptionGen c) Remove an exception handler. | |
| removeExceptionHandlers | back to summary |
|---|---|
| public void removeExceptionHandlers() Remove all line numbers. | |
| removeExceptions | back to summary |
|---|---|
| public void removeExceptions() Remove all exceptions. | |
| removeLineNumber | back to summary |
|---|---|
| public void removeLineNumber(LineNumberGen l) Remove a line number. | |
| removeLineNumbers | back to summary |
|---|---|
| public void removeLineNumbers() Remove all line numbers. | |
| removeLocalVariable | back to summary |
|---|---|
| public void removeLocalVariable(LocalVariableGen l) Remove a local variable, its slot will not be reused, if you do not use addLocalVariable with an explicit index argument. | |
| removeLocalVariables | back to summary |
|---|---|
| public void removeLocalVariables() Remove all local variables. | |
| setArgumentName | back to summary |
|---|---|
| public void setArgumentName(int i, String name) | |
| setArgumentNames | back to summary |
|---|---|
| public void setArgumentNames(String[] arg_names) | |
| setArgumentType | back to summary |
|---|---|
| public void setArgumentType(int i, Type type) | |
| setArgumentTypes | back to summary |
|---|---|
| public void setArgumentTypes(Type[] arg_types) | |
| setClassName | back to summary |
|---|---|
| public void setClassName(String class_name) | |
| setInstructionList | back to summary |
|---|---|
| public void setInstructionList(InstructionList il) | |
| setMaxLocals | back to summary |
|---|---|
| public void setMaxLocals(int m) Set maximum number of local variables. | |
| setMaxLocals | back to summary |
|---|---|
| public void setMaxLocals() Compute maximum number of local variables based on the parameter count and bytecode usage of variables. | |
| setMaxLocals | back to summary |
|---|---|
| public void setMaxLocals(boolean respectLocalVariableTable) Compute maximum number of local variables.
| |
| setMaxStack | back to summary |
|---|---|
| public void setMaxStack(int m) Set maximum stack size for this method. | |
| setMaxStack | back to summary |
|---|---|
| public void setMaxStack() Computes max. stack size by performing control flow analysis. | |
| setReturnType | back to summary |
|---|---|
| public void setReturnType(Type return_type) | |
| sort | back to summary |
|---|---|
| private static final void sort(LocalVariableGen[] vars, int l, int r) Sort local variables by index | |
| stripAttributes | back to summary |
|---|---|
| public void stripAttributes(boolean flag) | |
| toString | back to summary |
|---|---|
| public final String toString() Overrides java. Return string representation close to declaration format, `public static void main(String[]) throws IOException', e.g. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Stack | |
| pack-priv Map |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public MethodGen. | |
| public void | |
| private final MethodGen. | |
| private final boolean |
| branchTargets | back to summary |
|---|---|
| pack-priv Stack<MethodGen. | |
| visitedTargets | back to summary |
|---|---|
| pack-priv Map<InstructionHandle, MethodGen. | |
| BranchStack | back to summary |
|---|---|
| pack-priv BranchStack() | |
| pop | back to summary |
|---|---|
| public MethodGen. | |
| push | back to summary |
|---|---|
| public void push(InstructionHandle target, int stackDepth) | |
| visit | back to summary |
|---|---|
| private final MethodGen. | |
| visited | back to summary |
|---|---|
| private final boolean visited(InstructionHandle target) | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv InstructionHandle |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| stackDepth | back to summary |
|---|---|
| pack-priv int stackDepth | |
| target | back to summary |
|---|---|
| pack-priv InstructionHandle target | |
| BranchTarget | back to summary |
|---|---|
| pack-priv BranchTarget(InstructionHandle target, int stackDepth) | |