Package gnu.bytecode
Class Method
- java.lang.Object
-
- gnu.bytecode.Method
-
- All Implemented Interfaces:
AttrContainer
,Member
public class Method extends Object implements AttrContainer, Member
Represents a method in aClassType
.A
Method
contain aCodeAttr
object; the interface for generating bytecode instructions is primarily inCodeAttr
.All the methods whose name start with
compile_
are deprecated, and should not be used; use the methods inCodeAttr
instead.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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 Annotation>
TgetAnnotation(Class<T> clas)
Attribute
getAttributes()
Get the (first) Attribute of this container.CodeAttr
getCode()
ConstantPool
getConstants()
ClassType
getDeclaringClass()
ExceptionsAttr
getExceptionAttr()
ClassType[]
getExceptions()
int
getModifiers()
String
getName()
Method
getNext()
Type[]
getParameterTypes()
Type
getReturnType()
String
getSignature()
boolean
getStaticFlag()
void
init_param_slots()
Deprecated.Use startCode insteadvoid
initCode()
Allocate a Code attribute, and prepare to generate code.boolean
isAbstract()
boolean
isNative()
void
listParameters(StringBuffer sbuf)
static String
makeGenericSignature(Type[] arg_types, Type return_type)
static 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(short[] exn_indices)
void
setExceptions(ClassType[] exn_types)
void
setModifiers(int modifiers)
void
setName(int name_index)
void
setName(String name)
void
setReturnType(Type type)
void
setSignature(int signature_index)
void
setSignature(String signature)
void
setStaticFlag(boolean is_static)
CodeAttr
startCode()
Recommended method to create a new CodeAttr for this Method.String
toString()
-
-
-
Method Detail
-
getAttributes
public final Attribute getAttributes()
Description copied from interface:AttrContainer
Get the (first) Attribute of this container.- Specified by:
getAttributes
in interfaceAttrContainer
-
setAttributes
public final void setAttributes(Attribute attributes)
Description copied from interface:AttrContainer
Set the (list of) Attributes of this container.- Specified by:
setAttributes
in interfaceAttrContainer
-
getExceptionAttr
public final ExceptionsAttr getExceptionAttr()
-
setExceptions
public void setExceptions(short[] exn_indices)
-
setExceptions
public void setExceptions(ClassType[] exn_types)
-
getCode
public final CodeAttr getCode()
-
setStaticFlag
public final void setStaticFlag(boolean is_static)
-
getStaticFlag
public final boolean getStaticFlag()
- Specified by:
getStaticFlag
in interfaceMember
-
isAbstract
public final boolean isAbstract()
-
isNative
public final boolean isNative()
-
getModifiers
public int getModifiers()
- Specified by:
getModifiers
in interfaceMember
-
setModifiers
public void setModifiers(int modifiers)
-
getConstants
public final ConstantPool getConstants()
- Specified by:
getConstants
in interfaceAttrContainer
-
pushScope
public Scope pushScope()
-
reachableHere
public final boolean reachableHere()
True if control could reach here.
-
popScope
public Scope popScope()
-
allocate_local
@Deprecated public void allocate_local(Variable local)
Deprecated.Allocate slots for a local variable (or parameter).- Parameters:
local
- the variable we need to allocate
-
initCode
public void initCode()
Allocate a Code attribute, and prepare to generate code. Most code generators should use the startCode convenience method.
-
init_param_slots
public void init_param_slots()
Deprecated.Use startCode instead
-
startCode
public CodeAttr startCode()
Recommended method to create a new CodeAttr for this Method.
-
compile_checkcast
public void compile_checkcast(Type type)
-
maybe_compile_checkcast
public void maybe_compile_checkcast(Type type)
-
push_var
public void push_var(Variable var)
Deprecated.Comple code to push the contents of a local variable onto the statck.- Parameters:
var
- The variable whose contents we want to push.
-
compile_push_value
@Deprecated public void compile_push_value(Variable var)
Deprecated.
-
compile_store_value
@Deprecated public void compile_store_value(Variable var)
Deprecated.
-
compile_push_this
public void compile_push_this()
-
getSignature
public String getSignature()
-
setSignature
public void setSignature(String signature)
-
setSignature
public void setSignature(int signature_index)
-
getAnnotation
public <T extends Annotation> T getAnnotation(Class<T> clas)
- Specified by:
getAnnotation
in interfaceMember
-
getDeclaringClass
public ClassType getDeclaringClass()
- Specified by:
getDeclaringClass
in interfaceMember
-
getReturnType
public final Type getReturnType()
-
setReturnType
public final void setReturnType(Type type)
-
getParameterTypes
public final Type[] getParameterTypes()
-
getExceptions
public final ClassType[] getExceptions()
-
setName
public final void setName(int name_index)
-
getNext
public final Method getNext()
-
listParameters
public void listParameters(StringBuffer sbuf)
-
cleanupAfterCompilation
public void cleanupAfterCompilation()
-
-