gnu.bytecode

Class Method

public class Method extends Object implements AttrContainer, Member

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
voidallocate_local(Variable local)
Allocate slots for a local variable (or parameter).
voidcleanupAfterCompilation()
voidcompile_checkcast(Type type)
voidcompile_push_this()
voidcompile_push_value(Variable var)
voidcompile_store_value(Variable var)
AttributegetAttributes()
CodeAttrgetCode()
ConstantPoolgetConstants()
ClassTypegetDeclaringClass()
ExceptionsAttrgetExceptionAttr()
ClassType[]getExceptions()
intgetModifiers()
StringgetName()
MethodgetNext()
Type[]getParameterTypes()
TypegetReturnType()
StringgetSignature()
booleangetStaticFlag()
voidinitCode()
Allocate a Code attribute, and prepare to generate code.
voidinit_param_slots()
booleanisAbstract()
voidlistParameters(StringBuffer sbuf)
static MethodmakeCloneMethod(Type returnType)
Make a generic "clone" method.
voidmaybe_compile_checkcast(Type type)
ScopepopScope()
ScopepushScope()
voidpush_var(Variable var)
Comple code to push the contents of a local variable onto the statck.
booleanreachableHere()
True if control could reach here.
voidsetAttributes(Attribute attributes)
voidsetExceptions(short[] exn_indices)
voidsetExceptions(ClassType[] exn_types)
voidsetModifiers(int modifiers)
voidsetName(String name)
voidsetName(int name_index)
voidsetSignature(String signature)
voidsetSignature(int signature_index)
voidsetStaticFlag(boolean is_static)
CodeAttrstartCode()
Recommended method to create a new CodeAttr for this Method.
StringtoString()

Method Detail

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

cleanupAfterCompilation

public void cleanupAfterCompilation()

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()

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()

listParameters

public void listParameters(StringBuffer sbuf)

makeCloneMethod

public static Method makeCloneMethod(Type returnType)
Make a generic "clone" method. This is used for array types.

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)

setExceptions

public void setExceptions(short[] exn_indices)

setExceptions

public void setExceptions(ClassType[] exn_types)

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()