Package gnu.bytecode
Class Method
java.lang.Object
gnu.bytecode.Method
- All Implemented Interfaces:
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidallocate_local(Variable local) Deprecated.voidvoidcompile_checkcast(Type type) voidvoidDeprecated.voidDeprecated.<T extends Annotation>
TgetAnnotation(Class<T> clas) final AttributeGet the (first) Attribute of this container.final CodeAttrgetCode()final ConstantPoolfinal ExceptionsAttrfinal ClassType[]intfinal StringgetName()final MethodgetNext()final Type[]final Typefinal booleanvoidDeprecated.Use startCode insteadvoidinitCode()Allocate a Code attribute, and prepare to generate code.final booleanfinal 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) popScope()voidDeprecated.final booleanTrue if control could reach here.final voidsetAttributes(Attribute attributes) Set the (list of) Attributes of this container.voidsetExceptions(short[] exn_indices) voidsetExceptions(ClassType[] exn_types) voidsetModifiers(int modifiers) final voidsetName(int name_index) final voidfinal voidsetReturnType(Type type) voidsetSignature(int signature_index) voidsetSignature(String signature) final voidsetStaticFlag(boolean is_static) Recommended method to create a new CodeAttr for this Method.toString()
-
Constructor Details
-
Method
A copy constructor, except you can override the declaring class. This can be used to improve binary compatibility by emitting method references where the declared class is the type of the receiver.
-
-
Method Details
-
getAttributes
Description copied from interface:AttrContainerGet the (first) Attribute of this container.- Specified by:
getAttributesin interfaceAttrContainer
-
setAttributes
Description copied from interface:AttrContainerSet the (list of) Attributes of this container.- Specified by:
setAttributesin interfaceAttrContainer
-
getExceptionAttr
-
setExceptions
public void setExceptions(short[] exn_indices) -
setExceptions
-
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
- Specified by:
getConstantsin interfaceAttrContainer
-
pushScope
-
reachableHere
public final boolean reachableHere()True if control could reach here. -
popScope
-
allocate_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
Recommended method to create a new CodeAttr for this Method. -
compile_checkcast
-
maybe_compile_checkcast
-
push_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. -
compile_store_value
Deprecated. -
compile_push_this
public void compile_push_this() -
makeSignature
-
makeGenericSignature
-
getSignature
-
setSignature
-
setSignature
public void setSignature(int signature_index) -
getAnnotation
- Specified by:
getAnnotationin interfaceMember
-
getDeclaringClass
- Specified by:
getDeclaringClassin interfaceMember
-
getReturnType
-
setReturnType
-
getParameterTypes
-
getExceptions
-
getName
-
setName
-
setName
public final void setName(int name_index) -
getNext
-
listParameters
-
toString
-
cleanupAfterCompilation
public void cleanupAfterCompilation()
-