Public Methods | |
MethodGen (int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) | |
MethodGen (Method m, String class_name, ConstantPoolGen cp) | |
void | addAttribute (Attribute a) |
void | addCodeAttribute (Attribute a) |
void | addException (String class_name) |
CodeExceptionGen | addExceptionHandler (InstructionHandle start_pc, InstructionHandle end_pc, InstructionHandle handler_pc, ObjectType catch_type) |
CodeExceptionGen | addExceptionHandler (InstructionHandle start_pc, InstructionHandle end_pc, InstructionHandle handler_pc, String catch_type) |
LineNumberGen | addLineNumber (InstructionHandle ih, int src_line) |
LocalVariableGen | addLocalVariable (String name, Type type, int slot, InstructionHandle start, InstructionHandle end) |
LocalVariableGen | addLocalVariable (String name, Type type, InstructionHandle start, InstructionHandle end) |
Type | getArgType (int i) |
Type[] | getArgTypes () |
Attribute[] | getAttributes () |
String | getClassName () |
Attribute[] | getCodeAttributes () |
ConstantPoolGen | getConstantPool () |
CodeExceptionGen[] | getExceptionHandlers () |
String[] | getExceptions () |
InstructionList | getInstructionList () |
LineNumberGen[] | getLineNumbers () |
LineNumberTable | getLineNumberTable (ConstantPoolGen cp) |
LocalVariableGen[] | getLocalVariables () |
LocalVariableTable | getLocalVariableTable (ConstantPoolGen cp) |
int | getMaxLocals () |
int | getMaxStack () |
Method | getMethod () |
String | getMethodName () |
String | getMethodSignature () |
Type | getReturnType () |
void | removeAttribute (Attribute a) |
void | removeCodeAttribute (Attribute a) |
void | removeException (String c) |
void | removeExceptionHandler (CodeExceptionGen c) |
void | removeLineNumber (LineNumberGen l) |
void | removeLocalVariable (LocalVariableGen l) |
void | removeNOPs () |
void | setArgType (int i, Type type) |
void | setArgTypes (Type[] arg_types) |
void | setConstantPool (ConstantPoolGen cp) |
void | setInstructionList (InstructionList il) |
void | setMaxLocals () |
void | setMaxLocals (int m) |
void | setMaxStack () |
void | setMaxStack (int m) |
void | setMethodName (String method_name) |
void | setReturnType (Type return_type) |
void | stripAttributes (boolean flag) |
MethodGen (int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) | |
MethodGen (Method m, String class_name, ConstantPoolGen cp) | |
void | addCodeAttribute (Attribute a) |
void | addException (String class_name) |
CodeExceptionGen | addExceptionHandler (InstructionHandle start_pc, InstructionHandle end_pc, InstructionHandle handler_pc, ObjectType catch_type) |
CodeExceptionGen | addExceptionHandler (InstructionHandle start_pc, InstructionHandle end_pc, InstructionHandle handler_pc, String catch_type) |
LineNumberGen | addLineNumber (InstructionHandle ih, int src_line) |
LocalVariableGen | addLocalVariable (String name, Type type, int slot, InstructionHandle start, InstructionHandle end) |
LocalVariableGen | addLocalVariable (String name, Type type, InstructionHandle start, InstructionHandle end) |
void | addObserver (MethodObserver o) |
String | getArgName (int i) |
String[] | getArgNames () |
Type | getArgType (int i) |
Type[] | getArgTypes () |
String | getClassName () |
Attribute[] | getCodeAttributes () |
CodeExceptionGen[] | getExceptionHandlers () |
String[] | getExceptions () |
InstructionList | getInstructionList () |
LineNumberGen[] | getLineNumbers () |
LineNumberTable | getLineNumberTable (ConstantPoolGen cp) |
LocalVariableGen[] | getLocalVariables () |
LocalVariableTable | getLocalVariableTable (ConstantPoolGen cp) |
int | getMaxLocals () |
int | getMaxStack () |
Method | getMethod () |
String | getMethodName () |
String | getMethodSignature () |
Type | getReturnType () |
String | getSignature () |
void | removeCodeAttribute (Attribute a) |
void | removeException (String c) |
void | removeExceptionHandler (CodeExceptionGen c) |
void | removeExceptionHandlers () |
void | removeExceptions () |
void | removeLineNumber (LineNumberGen l) |
void | removeLineNumbers () |
void | removeLocalVariable (LocalVariableGen l) |
void | removeLocalVariables () |
void | removeNOPs () |
void | removeObserver (MethodObserver o) |
void | setArgName (int i, String name) |
void | setArgNames (String[] arg_names) |
void | setArgType (int i, Type type) |
void | setArgTypes (Type[] arg_types) |
void | setClassName (String class_name) |
void | setInstructionList (InstructionList il) |
void | setMaxLocals () |
void | setMaxLocals (int m) |
void | setMaxStack () |
void | setMaxStack (int m) |
void | setMethodName (String method_name) |
void | setReturnType (Type return_type) |
void | stripAttributes (boolean flag) |
final String | toString () |
void | update () |
Static Public Methods | |
int | getMaxStack (ConstantPoolGen cp, InstructionList il, CodeExceptionGen[] et) |
int | getMaxStack (ConstantPoolGen cp, InstructionList il, CodeExceptionGen[] et) |
Private Methods | |
CodeException[] | getCodeExceptions () |
ExceptionTable | getExceptionTable (ConstantPoolGen cp) |
CodeException[] | getCodeExceptions () |
ExceptionTable | getExceptionTable (ConstantPoolGen cp) |
Static Private Methods | |
final void | sort (LocalVariableGen[] vars, int l, int r) |
Private Attributes | |
String | method_name |
String | class_name |
Type | return_type |
Type[] | arg_types |
String[] | arg_names |
int | max_locals |
int | max_stack |
InstructionList | il |
ConstantPoolGen | cp |
boolean | strip_attributes |
Vector | variable_vec = new Vector() |
Vector | line_number_vec = new Vector() |
Vector | attribute_vec = new Vector() |
Vector | exception_vec = new Vector() |
Vector | throws_vec = new Vector() |
Vector | code_attrs_vec = new Vector() |
Type[] | arg_types |
String[] | arg_names |
Vector | observers |
While generating code it may be necessary to insert NOP operations. You can use the `removeNOPs' method to get rid off them. The resulting method object can be obtained via the `getMethod()' method.
Definition at line 23 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java.
|
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.
Definition at line 106 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Instantiate from existing method.
Definition at line 153 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
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.
Definition at line 104 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Instantiate from existing method.
Definition at line 151 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Add an attribute to this method. Currently, the JVM knows about the `Code' and `Exceptions' attribute, which will be generated automatically. Other attributes will be ignored by the JVM but do no harm.
Reimplemented from FieldGenOrMethodGen. Definition at line 239 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Add an attribute to the code. Currently, the JVM knows about the `LineNumberTable' and `LocalVariableTable' attributes, which will be generated automatically. Other attributes will be ignored by the JVM but do no harm.
Definition at line 238 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Add an attribute to the code. Currently, the JVM knows about the `LineNumberTable' and `LocalVariableTable' attributes, which will be generated automatically. Other attributes will be ignored by the JVM but do no harm.
Definition at line 247 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Add an exception possibly thrown by this method.
Definition at line 244 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Add an exception possibly thrown by this method.
Definition at line 253 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 273 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Add an exception handler, i.e., specify region where a handler is active and an instruction where the actual handling is done.
Definition at line 258 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 282 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Add an exception handler, i.e. specify region where a handler is active and an instruction where the actual handling is done.
Definition at line 267 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Give an instruction a line number corresponding to the source code line.
Definition at line 287 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Give an instruction a line number corresponding to the source code line.
Definition at line 296 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Adds a local variable to this method and assigns an index automatically.
Definition at line 334 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Adds a local variable to this method.
Definition at line 304 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Adds a local variable to this method and assigns an index automatically.
Definition at line 343 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Adds a local variable to this method.
Definition at line 313 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Add observer for this object. Definition at line 341 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Reimplemented from FieldGenOrMethodGen. Definition at line 353 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 353 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 357 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 362 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 365 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 370 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 397 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 403 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 421 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 427 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 460 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 463 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Computes stack usage of an instruction list by performing control flow analysis.
Definition at line 478 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Computes stack usage of an instruction list by performing control flow analysis.
Definition at line 481 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Get method object. Never forget to call setMaxStack() or setMaxStack(max), respectively, before calling this method. This method should be called exactly once when the buildup is finished.
Definition at line 554 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Get method object. Never forget to call setMaxStack() or setMaxStack(max), respectively, before calling this method. This method should be called exactly once when the buildup is finished.
Definition at line 556 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 606 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 609 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Reimplemented from FieldGenOrMethodGen. Definition at line 613 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove an attribute. Reimplemented from FieldGenOrMethodGen. Definition at line 614 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Remove a code attribute. Definition at line 619 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove a code attribute. Definition at line 618 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Remove an exception. Definition at line 623 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove an exception. Definition at line 622 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Remove an exception handler. Definition at line 629 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove an exception handler. Definition at line 628 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Remove all line numbers. Definition at line 635 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove all exceptions. Definition at line 641 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove a line number. Definition at line 647 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove a line number. Definition at line 634 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Remove all line numbers. Definition at line 653 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove a local variable, its slot will not be reused, if you do not use addLocalVariable with an explicit index argument. Definition at line 660 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove a local variable, its slot will not be reused, if you do not use addLocalVariable with an explicit `slot' argument. Definition at line 641 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Remove all local variables. Definition at line 666 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove all NOPs from the instruction list (if possible) and update every object refering to them, i.e., branch instructions, local variables and exception handlers. Definition at line 674 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Remove all NOPs from the instruction list (if possible) and update every object refering to them, i.e. branch instructions, local variables and exception handlers. Definition at line 649 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Remove observer for this object. Definition at line 701 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Set maximum number of local variables. Definition at line 741 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Compute maximum number of local variables. May be a little bit to large, but who cares ... Definition at line 714 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Set maximum number of local variables. Definition at line 706 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Compute maximum number of local variables. May be a little bit to large, but who cares ... Definition at line 681 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Set maximum stack size for this method. Definition at line 755 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Computes max. stack size by performing control flow analysis.
Definition at line 746 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Set maximum stack size for this method. Definition at line 720 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Computes max. stack size by performing control flow analysis.
Definition at line 711 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Definition at line 758 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Sort local variables by index Definition at line 763 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Do not/Do produce attributes code attributesLineNumberTable and LocalVariableTable, like javac -O Definition at line 784 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Do not/Do produce attributes code attributesLineNumberTable and LocalVariableTable, like javac -O Definition at line 726 of file lib/jpf/de/fub/bytecode/generic/MethodGen.java. |
|
Return string representation close to declaration format, `public static int main(String[]) throws IOException', e.g.
Definition at line 791 of file src/de/fub/bytecode/generic/MethodGen.java. |
|
Call notify() method on all observers. This method is not called automatically whenever the state has changed, but has to be called by the user after he has finished editing the object. Definition at line 810 of file src/de/fub/bytecode/generic/MethodGen.java. |