public class Method extends java.lang.Object implements AttrContainer, Member
ClassType.
A Method contain a CodeAttr object;
the interface for generating bytecode instructions is primarily
in CodeAttr.
All the methods whose name start with compile_ are
deprecated, and should not be used; use the methods
in CodeAttrinstead.
| Constructor and Description |
|---|
Method(Method base,
ClassType clas)
A copy constructor, except you can override the declaring class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
allocate_local(Variable local)
Deprecated.
|
void |
cleanupAfterCompilation() |
void |
compile_checkcast(Type type) |
void |
compile_push_this() |
void |
compile_push_value(Variable var)
Deprecated.
|
void |
compile_store_value(Variable var)
Deprecated.
|
<T extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.Class<T> clas) |
Attribute |
getAttributes()
Get the (first) Attribute of this container.
|
CodeAttr |
getCode() |
ConstantPool |
getConstants() |
ClassType |
getDeclaringClass() |
ExceptionsAttr |
getExceptionAttr() |
ClassType[] |
getExceptions() |
int |
getModifiers() |
java.lang.String |
getName() |
Method |
getNext() |
Type[] |
getParameterTypes() |
Type |
getReturnType() |
java.lang.String |
getSignature() |
boolean |
getStaticFlag() |
void |
init_param_slots()
Deprecated.
Use startCode instead
|
void |
initCode()
Allocate a Code attribute, and prepare to generate code.
|
boolean |
isAbstract() |
boolean |
isNative() |
void |
listParameters(java.lang.StringBuffer sbuf) |
static Method |
makeCloneMethod(Type returnType)
Make a generic "clone" method.
|
static java.lang.String |
makeGenericSignature(Type[] arg_types,
Type return_type) |
static java.lang.String |
makeSignature(Type[] arg_types,
Type return_type) |
void |
maybe_compile_checkcast(Type type) |
Scope |
popScope() |
void |
push_var(Variable var)
Deprecated.
|
Scope |
pushScope() |
boolean |
reachableHere()
True if control could reach here.
|
void |
setAttributes(Attribute attributes)
Set the (list of) Attributes of this container.
|
void |
setExceptions(ClassType[] exn_types) |
void |
setExceptions(short[] exn_indices) |
void |
setModifiers(int modifiers) |
void |
setName(int name_index) |
void |
setName(java.lang.String name) |
void |
setReturnType(Type type) |
void |
setSignature(int signature_index) |
void |
setSignature(java.lang.String signature) |
void |
setStaticFlag(boolean is_static) |
CodeAttr |
startCode()
Recommended method to create a new CodeAttr for this Method.
|
java.lang.String |
toString() |
public final Attribute getAttributes()
AttrContainergetAttributes in interface AttrContainerpublic final void setAttributes(Attribute attributes)
AttrContainersetAttributes in interface AttrContainerpublic final ExceptionsAttr getExceptionAttr()
public void setExceptions(short[] exn_indices)
public void setExceptions(ClassType[] exn_types)
public final CodeAttr getCode()
public static Method makeCloneMethod(Type returnType)
public final void setStaticFlag(boolean is_static)
public final boolean getStaticFlag()
getStaticFlag in interface Memberpublic final boolean isAbstract()
public final boolean isNative()
public int getModifiers()
getModifiers in interface Memberpublic void setModifiers(int modifiers)
public final ConstantPool getConstants()
getConstants in interface AttrContainerpublic Scope pushScope()
public final boolean reachableHere()
public Scope popScope()
public void allocate_local(Variable local)
local - the variable we need to allocatepublic void initCode()
public void init_param_slots()
public CodeAttr startCode()
public void compile_checkcast(Type type)
public void maybe_compile_checkcast(Type type)
public void push_var(Variable var)
var - The variable whose contents we want to push.public void compile_push_value(Variable var)
public void compile_store_value(Variable var)
public void compile_push_this()
public static java.lang.String makeGenericSignature(Type[] arg_types, Type return_type)
public java.lang.String getSignature()
public void setSignature(java.lang.String signature)
public void setSignature(int signature_index)
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> clas)
public ClassType getDeclaringClass()
getDeclaringClass in interface Memberpublic final Type getReturnType()
public final void setReturnType(Type type)
public final Type[] getParameterTypes()
public final ClassType[] getExceptions()
public final void setName(int name_index)
public final Method getNext()
public void listParameters(java.lang.StringBuffer sbuf)
public java.lang.String toString()
toString in class java.lang.Objectpublic void cleanupAfterCompilation()