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
Methodcontain aCodeAttrobject; 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 inCodeAttrinstead.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidallocate_local(Variable local)Deprecated.voidcleanupAfterCompilation()voidcompile_checkcast(Type type)voidcompile_push_this()voidcompile_push_value(Variable var)Deprecated.voidcompile_store_value(Variable var)Deprecated.<T extends Annotation>
TgetAnnotation(Class<T> clas)AttributegetAttributes()Get the (first) Attribute of this container.CodeAttrgetCode()ConstantPoolgetConstants()ClassTypegetDeclaringClass()ExceptionsAttrgetExceptionAttr()ClassType[]getExceptions()intgetModifiers()StringgetName()MethodgetNext()Type[]getParameterTypes()TypegetReturnType()StringgetSignature()booleangetStaticFlag()voidinit_param_slots()Deprecated.Use startCode insteadvoidinitCode()Allocate a Code attribute, and prepare to generate code.booleanisAbstract()booleanisNative()voidlistParameters(StringBuffer sbuf)static StringmakeGenericSignature(Type[] arg_types, Type return_type)static StringmakeSignature(Type[] arg_types, Type return_type)voidmaybe_compile_checkcast(Type type)ScopepopScope()voidpush_var(Variable var)Deprecated.ScopepushScope()booleanreachableHere()True if control could reach here.voidsetAttributes(Attribute attributes)Set the (list of) Attributes of this container.voidsetExceptions(short[] exn_indices)voidsetExceptions(ClassType[] exn_types)voidsetModifiers(int modifiers)voidsetName(int name_index)voidsetName(String name)voidsetReturnType(Type type)voidsetSignature(int signature_index)voidsetSignature(String signature)voidsetStaticFlag(boolean is_static)CodeAttrstartCode()Recommended method to create a new CodeAttr for this Method.StringtoString()
-
-
-
Method Detail
-
getAttributes
public final Attribute getAttributes()
Description copied from interface:AttrContainerGet the (first) Attribute of this container.- Specified by:
getAttributesin interfaceAttrContainer
-
setAttributes
public final void setAttributes(Attribute attributes)
Description copied from interface:AttrContainerSet the (list of) Attributes of this container.- Specified by:
setAttributesin 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:
getStaticFlagin interfaceMember
-
isAbstract
public final boolean isAbstract()
-
isNative
public final boolean isNative()
-
getModifiers
public int getModifiers()
- Specified by:
getModifiersin interfaceMember
-
setModifiers
public void setModifiers(int modifiers)
-
getConstants
public final ConstantPool getConstants()
- Specified by:
getConstantsin 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:
getAnnotationin interfaceMember
-
getDeclaringClass
public ClassType getDeclaringClass()
- Specified by:
getDeclaringClassin 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()
-
-