Interface CodeAttribute
- All Superinterfaces:
Attribute<CodeAttribute>, AttributedElement, ClassFileElement, CodeModel, CompoundElement<CodeElement>, Iterable<CodeElement>, MethodElement
Models the
Code attribute (JVMS 4.7.3), appears on non-native,
non-abstract methods and contains the bytecode of the method body. Delivered
as a MethodElement when traversing the elements of a
MethodModel.
The attribute does not permit multiple instances in a given location. Subsequent occurrence of the attribute takes precedence during the attributed element build or transformation.
- Since:
- 24
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]Returns the bytes (bytecode) of the code array.intReturns The length of the code array in bytes.intlabelToBci(Label label) Returns the position of thelabelin thecodeArray.intReturns the maximum size of the local variable table.intmaxStack()Returns the maximum size of the operand stack.Methods declared in interface Attribute
attributeMapper, attributeNameMethods declared in interface AttributedElement
attributes, findAttribute, findAttributesMethods declared in interface CodeModel
exceptionHandlers, parentMethods declared in interface CompoundElement
elementList, elementStream, forEach, iterator, toDebugStringMethods declared in interface Iterable
spliterator
-
Method Details
-
maxLocals
int maxLocals()Returns the maximum size of the local variable table.- Returns:
- the maximum size of the local variable table
-
maxStack
int maxStack()Returns the maximum size of the operand stack.- Returns:
- the maximum size of the operand stack
-
codeLength
int codeLength()Returns The length of the code array in bytes.- Returns:
- The length of the code array in bytes
-
codeArray
byte[] codeArray()Returns the bytes (bytecode) of the code array.- Returns:
- the bytes (bytecode) of the code array
-
labelToBci
Returns the position of thelabelin thecodeArray.- Parameters:
label- a marker for a position within thisCodeAttribute- Returns:
- the position of the
labelin thecodeArray - Throws:
IllegalArgumentException- if thelabelis not from this attribute
-