Interface CodeAttribute
- All Superinterfaces:
- Attribute<CodeAttribute>, AttributedElement, ClassFileElement, CodeModel, CompoundElement<CodeElement>, Iterable<CodeElement>, MethodElement
Models the 
Code attribute (JVMS 4.7.3),
which contains the bytecode of this method.
This attribute only appears on methods, and does not permit multiple instances in a method. It has a data dependency on the constant pool.
This attribute was introduced in the Java Platform version 1.0.2, major version 45.
- API Note:
- CodeAttributemodels properties of a- Codeattribute read from- classfiles. General- classfile transformation should process and traverse a- CodeModelin the traversal of a- MethodModel, to support transformation of- Codeattributes currently being built.
- See Java Virtual Machine Specification:
- 
4.7.3 The CodeAttribute
- Since:
- 24
- See Also:
- 
Method SummaryModifier 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 AttributeattributeMapper, attributeNameMethods declared in interface AttributedElementattributes, findAttribute, findAttributesMethods declared in interface CodeModelexceptionHandlers, parentMethods declared in interface CompoundElementelementList, elementStream, forEach, iterator, toDebugStringMethods declared in interface Iterablespliterator
- 
Method Details- 
maxLocalsint maxLocals()Returns the maximum size of the local variable table.- Returns:
- the maximum size of the local variable table
 
- 
maxStackint maxStack()Returns the maximum size of the operand stack.- Returns:
- the maximum size of the operand stack
 
- 
codeLengthint codeLength()Returns The length of the code array in bytes.- Returns:
- The length of the code array in bytes
 
- 
codeArraybyte[] codeArray()Returns the bytes (bytecode) of the code array.- Returns:
- the bytes (bytecode) of the code array
 
- 
labelToBciReturns the position of thelabelin thecodeArray. The label represents a cursor pointing at immediately before the returned index into thecodearray.- Parameters:
- label- a marker for a position within this- CodeAttribute
- Returns:
- the position of the labelin thecodeArray
- Throws:
- IllegalArgumentException- if the- labelis not from this attribute
 
 
-