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 CodeAttr
instead.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
allocate_local
(Variable local) Deprecated.void
void
compile_checkcast
(Type type) void
void
Deprecated.void
Deprecated.<T extends Annotation>
TgetAnnotation
(Class<T> clas) final Attribute
Get the (first) Attribute of this container.final CodeAttr
getCode()
final ConstantPool
final ExceptionsAttr
final ClassType[]
int
final String
getName()
final Method
getNext()
final Type[]
final Type
final boolean
void
Deprecated.Use startCode insteadvoid
initCode()
Allocate a Code attribute, and prepare to generate code.final boolean
final boolean
isNative()
void
listParameters
(StringBuffer sbuf) static String
makeGenericSignature
(Type[] arg_types, Type return_type) static String
makeSignature
(Type[] arg_types, Type return_type) void
maybe_compile_checkcast
(Type type) popScope()
void
Deprecated.final boolean
True if control could reach here.final void
setAttributes
(Attribute attributes) Set the (list of) Attributes of this container.void
setExceptions
(short[] exn_indices) void
setExceptions
(ClassType[] exn_types) void
setModifiers
(int modifiers) final void
setName
(int name_index) final void
final void
setReturnType
(Type type) void
setSignature
(int signature_index) void
setSignature
(String signature) final void
setStaticFlag
(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:AttrContainer
Get the (first) Attribute of this container.- Specified by:
getAttributes
in interfaceAttrContainer
-
setAttributes
Description copied from interface:AttrContainer
Set the (list of) Attributes of this container.- Specified by:
setAttributes
in 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:
getStaticFlag
in interfaceMember
-
isAbstract
public final boolean isAbstract() -
isNative
public final boolean isNative() -
getModifiers
public int getModifiers()- Specified by:
getModifiers
in interfaceMember
-
setModifiers
public void setModifiers(int modifiers) -
getConstants
- Specified by:
getConstants
in 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:
getAnnotation
in interfaceMember
-
getDeclaringClass
- Specified by:
getDeclaringClass
in interfaceMember
-
getReturnType
-
setReturnType
-
getParameterTypes
-
getExceptions
-
getName
-
setName
-
setName
public final void setName(int name_index) -
getNext
-
listParameters
-
toString
-
cleanupAfterCompilation
public void cleanupAfterCompilation()
-