gnu.bytecode
Class Method

java.lang.Object
  extended by gnu.bytecode.Method
All Implemented Interfaces:
AttrContainer, Member

public class Method
extends java.lang.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
 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.  
 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()
           
 void listParameters(java.lang.StringBuffer sbuf)
           
static Method makeCloneMethod(Type returnType)
          Make a generic "clone" method.
 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 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getAttributes

public final Attribute getAttributes()
Description copied from interface: AttrContainer
Get the (first) Attribute of this container.

Specified by:
getAttributes in interface AttrContainer

setAttributes

public final void setAttributes(Attribute attributes)
Description copied from interface: AttrContainer
Set the (list of) Attributes of this container.

Specified by:
setAttributes in interface AttrContainer

getExceptionAttr

public final ExceptionsAttr getExceptionAttr()

setExceptions

public void setExceptions(short[] exn_indices)

setExceptions

public void setExceptions(ClassType[] exn_types)

getCode

public final CodeAttr getCode()

makeCloneMethod

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


setStaticFlag

public final void setStaticFlag(boolean is_static)

getStaticFlag

public final boolean getStaticFlag()
Specified by:
getStaticFlag in interface Member

isAbstract

public final boolean isAbstract()

getModifiers

public int getModifiers()
Specified by:
getModifiers in interface Member

setModifiers

public void setModifiers(int modifiers)

getConstants

public final ConstantPool getConstants()

pushScope

public Scope pushScope()

reachableHere

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


popScope

public Scope popScope()

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

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

public void compile_push_value(Variable var)
Deprecated. 


compile_store_value

public void compile_store_value(Variable var)
Deprecated. 


compile_push_this

public void compile_push_this()

getSignature

public java.lang.String getSignature()

setSignature

public void setSignature(java.lang.String signature)

setSignature

public void setSignature(int signature_index)

getDeclaringClass

public ClassType getDeclaringClass()
Specified by:
getDeclaringClass in interface Member

getReturnType

public final Type getReturnType()

getParameterTypes

public final Type[] getParameterTypes()

getExceptions

public final ClassType[] getExceptions()

getName

public final java.lang.String getName()
Specified by:
getName in interface Member

setName

public final void setName(java.lang.String name)
Specified by:
setName in interface Member

setName

public final void setName(int name_index)

getNext

public final Method getNext()

listParameters

public void listParameters(java.lang.StringBuffer sbuf)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

cleanupAfterCompilation

public void cleanupAfterCompilation()