Overview | Package | Class | Tree | Deprecated | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--DE.fub.inf.JVM.ClassGen.MethodGen
Constructor Summary | |
MethodGen(int access_flags,
Type return_type,
Type[] arg_types,
java.lang.String[] arg_names,
java.lang.String method_name,
java.lang.String class_name,
InstructionList il,
ConstantPoolGen cp)
Declare method. |
|
MethodGen(Method m,
java.lang.String class_name,
ConstantPoolGen cp)
Instantiate from existing method. |
Method Summary | |
void | addAttribute(Attribute a)
Add an attribute to this method. |
void | addCodeAttribute(Attribute a)
Add an attribute to the code. |
CodeExceptionGen | addExceptionHandler(InstructionHandle start_pc,
InstructionHandle end_pc,
InstructionHandle handler_pc,
java.lang.String catch_type)
Add an exception handler, i.e. specify region where a handler is active and an instruction where the actual handling is done. |
void | addException(java.lang.String class_name)
Add an exception possibly thrown by this method. |
LineNumberGen | addLineNumber(InstructionHandle ih,
int src_line)
Give an instruction a line number corresponding to the source code line. |
LocalVariableGen | addLocalVariable(java.lang.String name,
Type type,
int slot,
InstructionHandle start,
InstructionHandle end)
Add a local variable to this method. |
LocalVariableGen | addLocalVariable(java.lang.String name,
Type type,
InstructionHandle start,
InstructionHandle end)
Add a local variable to this method and assign an index automatically. |
int | getAccessFlags()
|
Type[] | getArgTypes()
|
Attribute[] | getAttributes()
|
java.lang.String | getClassName()
|
Attribute[] | getCodeAttributes()
|
ConstantPoolGen | getConstantPool()
|
CodeExceptionGen[] | getExceptionHandlers()
|
java.lang.String[] | getExceptions()
|
InstructionList | getInstructionList()
|
LineNumberGen[] | getLineNumbers()
|
LineNumberTable | getLineNumberTable(ConstantPoolGen cp)
|
LocalVariableGen[] | getLocalVariables()
|
LocalVariableTable | getLocalVariableTable(ConstantPoolGen cp)
|
int | getMaxLocals()
|
int | getMaxStack()
|
Method | getMethod(int max_stack)
Deprecated. Get method object. |
Method | getMethod()
Get method object. |
java.lang.String | getMethodName()
|
java.lang.String | getMethodSignature()
|
Type | getReturnType()
|
void | removeAttribute(Attribute a)
Remove an attribute. |
void | removeCodeAttribute(Attribute a)
Remove a code attribute. |
void | removeExceptionHandler(CodeExceptionGen c)
Remove an exception handler. |
void | removeException(java.lang.String c)
Remove an exception. |
void | removeLineNumber(LineNumberGen l)
Remove a line number. |
void | removeLocalVariable(LocalVariableGen l)
Remove a local variable, its slot will not be reused, if you do not use addLocalVariable with an explicit `slot' argument. |
void | removeNOPs()
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. |
void | setAccessFlags(short access_flags)
|
void | setArgTypes(Type[] arg_types)
|
void | setMaxLocals(int m)
Set maximum stack size for this method. |
void | setMaxStack(int m)
Set maximum number of local variables. |
void | setMethodName(java.lang.String method_name)
|
void | setReturnType(Type return_type)
|
Methods inherited from class java.lang.Object | |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
Constructor Detail |
public MethodGen(int access_flags, Type return_type, Type[] arg_types, java.lang.String[] arg_names, java.lang.String method_name, java.lang.String class_name, InstructionList il, ConstantPoolGen cp)
access_flags
- access qualifiers
return_type
- method type
arg_types
- argument types
arg_names
- argument names (if this is null, default names will be provided
for them)
method_name
- name of method
class_name
- class name containing this method
il
- instruction list associated with this method, may be null only for
abstract methods
cp
- constant poolpublic MethodGen(Method m, java.lang.String class_name, ConstantPoolGen cp)
m
- method
class_name
- class name containing this method
cp
- constant pool (must contain the same entries as the method's constant pool)Method Detail |
public LocalVariableGen addLocalVariable(java.lang.String name, Type type, int slot, InstructionHandle start, InstructionHandle end)
name
- variable name
type
- variable type
slot
- the index of the local variable, if type is long or double, the next available
index is slot+2
start
- from where the variable is valid
end
- until where the variable is validpublic LocalVariableGen addLocalVariable(java.lang.String name, Type type, InstructionHandle start, InstructionHandle end)
name
- variable name
type
- variable type
slot
- the index of the local variable, if type is long or double, the next available
index is slot+2
start
- from where the variable is valid, if this is null,
it is valid from the start
end
- until where the variable is valid, if this is null,
it is valid to the endpublic void removeLocalVariable(LocalVariableGen l)
public final LocalVariableGen[] getLocalVariables()
public final LocalVariableTable getLocalVariableTable(ConstantPoolGen cp)
public LineNumberGen addLineNumber(InstructionHandle ih, int src_line)
ih
- instruction to tagpublic void removeLineNumber(LineNumberGen l)
public final LineNumberGen[] getLineNumbers()
public final LineNumberTable getLineNumberTable(ConstantPoolGen cp)
public CodeExceptionGen addExceptionHandler(InstructionHandle start_pc, InstructionHandle end_pc, InstructionHandle handler_pc, java.lang.String catch_type)
start_pc
- Start of region
end_pc
- End of region
handler_pc
- Where handling is done
catch_type
- which exception is handled (fully qualified class name)public void removeExceptionHandler(CodeExceptionGen c)
public final CodeExceptionGen[] getExceptionHandlers()
public void addException(java.lang.String class_name)
class_name
- (fully qualified) name of exceptionpublic void removeException(java.lang.String c)
public final java.lang.String[] getExceptions()
public void addAttribute(Attribute a)
a
- attribute to be addedpublic void removeAttribute(Attribute a)
public final Attribute[] getAttributes()
public void addCodeAttribute(Attribute a)
a
- attribute to be addedpublic void removeCodeAttribute(Attribute a)
public final Attribute[] getCodeAttributes()
public final Method getMethod(int max_stack)
max_stack
- maximum stack size of this methodpublic Method getMethod()
public final void removeNOPs()
public void setMaxLocals(int m)
public void setMaxStack(int m)
public int getMaxLocals()
public int getMaxStack()
public void setMethodName(java.lang.String method_name)
public java.lang.String getMethodName()
public java.lang.String getClassName()
public void setReturnType(Type return_type)
public Type getReturnType()
public void setArgTypes(Type[] arg_types)
public Type[] getArgTypes()
public void setAccessFlags(short access_flags)
public int getAccessFlags()
public InstructionList getInstructionList()
public ConstantPoolGen getConstantPool()
public java.lang.String getMethodSignature()
Overview | Package | Class | Tree | Deprecated | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |