Class Code
java.lang.Object
org.fife.rsta.ac.java.classreader.attributes.AttributeInfo
org.fife.rsta.ac.java.classreader.attributes.Code
A variable-length attribute used in the attributes table of
MethodInfo structures. A Code attribute contains the
JVM instructions and auxiliary information for a single method, instance
initialization method, or class or interface initialization method. Every
JVM implementation must recognize Code attributes. If the
method is either native or abstract, its
MethodInfo structure must not have a Code
attribute. Otherwise, its MethodInfo structure must have
exactly one Code attribute.- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<AttributeInfo> Attributes of thisCodeattribute.private intThe size of the method's code, in bytes.private ExceptionTableEntry[]The exception handlers in thecodearray.private static final Stringprivate static final Stringprivate static final Stringprivate intThe number of local variables in the local variable array allocated upon invocation of this method, including the local variables used to pass parameters to the method on invocation.private intThe maximum depth of the operand stack of this method at any point during its execution.private MethodInfoThe parent method.private String[]The names of parameters to the parent method, if debugging was enabled during compilation.private static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the length of the code array, in bytes.intReturns the number of local variables in the local variable array allocated upon invocation of this method, including the local variables used to pass parameters to the method on invocation.intReturns the maximum depth of the operand stack of this method at any point during its execution.Returns the method containing this code.getParameterName(int index) If debugging was enabled during compilation, this method returns the name of the given parameter to this method.static Coderead(MethodInfo mi, DataInputStream in) Reads aCodeattribute from an input stream.private AttributeInfoReads an attribute for thisCodeattribute from an input stream.Methods inherited from class AttributeInfo
getClassFile, getName, readUnsupportedAttribute
-
Field Details
-
mi
The parent method. -
maxStack
private int maxStackThe maximum depth of the operand stack of this method at any point during its execution. -
maxLocals
private int maxLocalsThe number of local variables in the local variable array allocated upon invocation of this method, including the local variables used to pass parameters to the method on invocation.The greatest local variable index for a value of type
longordoubleismaxLocals-2. The greatest local variable index for a value of any other type ismaxLocals-1. -
codeLength
private int codeLengthThe size of the method's code, in bytes. -
exceptionTable
The exception handlers in thecodearray. The order of the handlers in this table is significant. -
paramNames
The names of parameters to the parent method, if debugging was enabled during compilation.- See Also:
-
attributes
Attributes of thisCodeattribute. -
LINE_NUMBER_TABLE
- See Also:
-
LOCAL_VARIABLE_TABLE
- See Also:
-
LOCAL_VARIABLE_TYPE_TABLE
- See Also:
-
STACK_MAP_TABLE
- See Also:
-
-
Constructor Details
-
Code
-
-
Method Details
-
getCodeLength
public int getCodeLength()Returns the length of the code array, in bytes.- Returns:
- The length of the code array.
-
getMaxLocals
public int getMaxLocals()Returns the number of local variables in the local variable array allocated upon invocation of this method, including the local variables used to pass parameters to the method on invocation.The greatest local variable index for a value of type
longordoubleismaxLocals-2. The greatest local variable index for a value of any other type ismaxLocals-1.- Returns:
- the maximum size of the local variable array.
-
getMaxStack
public int getMaxStack()Returns the maximum depth of the operand stack of this method at any point during its execution.- Returns:
- The maximum value of the operand stack.
-
getMethodInfo
Returns the method containing this code.- Returns:
- The method containing this code.
-
getParameterName
If debugging was enabled during compilation, this method returns the name of the given parameter to this method. Otherwise,nullis returned.- Parameters:
index- The index of the parameter.- Returns:
- The name of the parameter, or
null.
-
read
Reads aCodeattribute from an input stream.- Parameters:
mi- The parent method.in- The input stream.- Returns:
- The
Codeattribute. - Throws:
IOException- If an IO error occurs.
-
readAttribute
Reads an attribute for thisCodeattribute from an input stream.- Parameters:
in- The input stream to read from.- Returns:
- The attribute read.
- Throws:
IOException- If an IO error occurs.
-