gnu.bytecode

Class Method

Implemented Interfaces:
AttrContainer

public class Method
extends java.lang.Object
implements AttrContainer

Represents a method in a 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.

Method Summary

void
allocate_local(Variable local)
Deprecated.
void
compile_checkcast(Type type)
void
compile_push_this()
void
compile_push_value(Variable var)
Deprecated.
void
compile_store_value(Variable var)
Deprecated.
Attribute
getAttributes()
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
initCode()
Allocate a Code attribute, and prepare to generate code.
void
init_param_slots()
Deprecated. Use startCode instead
boolean
isAbstract()
void
maybe_compile_checkcast(Type type)
Scope
popScope()
Scope
pushScope()
void
push_var(Variable var)
Deprecated.
boolean
reachableHere()
True if control could reach here.
void
setAttributes(Attribute attributes)
void
setExceptions(ClassType[] exn_types)
void
setExceptions(short[] exn_indices)
void
setModifiers(int modifiers)
void
setName(String name)
void
setName(int name_index)
void
setSignature(String signature)
void
setSignature(int signature_index)
void
setStaticFlag(boolean is_static)
CodeAttr
startCode()
Recommended method to create a new CodeAttr for this Method.
String
toString()

Method Details

allocate_local

public void allocate_local(Variable local)

Deprecated.

Allocate slots for a local variable (or parameter).
Parameters:
local - the variable we need to allocate

compile_checkcast

public void compile_checkcast(Type type)

compile_push_this

public void compile_push_this()

compile_push_value

public void compile_push_value(Variable var)

Deprecated.


compile_store_value

public void compile_store_value(Variable var)

Deprecated.


getAttributes

public final Attribute getAttributes()
Specified by:
getAttributes in interface AttrContainer

getCode

public final CodeAttr getCode()

getConstants

public final ConstantPool getConstants()

getDeclaringClass

public ClassType getDeclaringClass()

getExceptionAttr

public final ExceptionsAttr getExceptionAttr()

getExceptions

public final ClassType[] getExceptions()

getModifiers

public int getModifiers()

getName

public final String getName()

getNext

public final Method getNext()

getParameterTypes

public final Type[] getParameterTypes()

getReturnType

public final Type getReturnType()

getSignature

public String getSignature()

getStaticFlag

public final boolean getStaticFlag()

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


isAbstract

public final boolean isAbstract()

maybe_compile_checkcast

public void maybe_compile_checkcast(Type type)

popScope

public Scope popScope()

pushScope

public Scope pushScope()

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.

reachableHere

public final boolean reachableHere()
True if control could reach here.

setAttributes

public final void setAttributes(Attribute attributes)
Specified by:
setAttributes in interface AttrContainer

setExceptions

public void setExceptions(ClassType[] exn_types)

setExceptions

public void setExceptions(short[] exn_indices)

setModifiers

public void setModifiers(int modifiers)

setName

public final void setName(String name)

setName

public final void setName(int name_index)

setSignature

public void setSignature(String signature)

setSignature

public void setSignature(int signature_index)

setStaticFlag

public final void setStaticFlag(boolean is_static)

startCode

public CodeAttr startCode()
Recommended method to create a new CodeAttr for this Method.

toString

public String toString()