Top Inners Fields Constructors Methods
jdk.internal.classfile.impl

public final Class CodeImpl

extends BoundCodeAttribute
implements CodeModel, LabelContext
Class Inheritance
All Implemented Interfaces
jdk.internal.classfile.impl.LabelContext, java.lang.classfile.CodeModel, java.lang.classfile.MethodElement, java.lang.classfile.ClassFileElement, java.lang.classfile.AttributedElement, java.lang.classfile.CompoundElement, java.lang.Iterable
Imports
java.util.ArrayList, .Collections, .List, .Optional, java.util.function.Consumer, java.lang.classfile.*, java.lang.classfile.attribute.CodeAttribute, .RuntimeInvisibleTypeAnnotationsAttribute, .RuntimeVisibleTypeAnnotationsAttribute, .StackMapTableAttribute, java.lang.classfile.constantpool.ClassEntry, java.lang.classfile.instruction.*

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Field Summary

Modifier and TypeField and Description
pack-priv List<Attribute<?>>
pack-priv List<ExceptionCatch>
pack-priv boolean
pack-priv LabelImpl[]
pack-priv int[]
pack-priv static final Instruction[]
Inherited from jdk.internal.classfile.impl.BoundAttribute.BoundCodeAttribute:
attributePoscodeEndcodeLengthcodeStartenclosingMethodexceptionHandlerCntexceptionHandlerPos

Constructor Summary

AccessConstructor and Description
public
CodeImpl(AttributedElement enclosing, ClassReader reader, AttributeMapper<CodeAttribute> mapper, int payloadStart)

Method Summary

Modifier and TypeMethod and Description
private int
public List<Attribute<?>>
attributes()

Implements java.lang.classfile.AttributedElement.attributes.

Returns the attributes of this element.

private Instruction
bcToInstruction(int bc, int pos)

public boolean
compareCodeBytes(BufWriter buf, int offset, int len)

public List<ExceptionCatch>
exceptionHandlers()

Implements java.lang.classfile.CodeModel.exceptionHandlers.

Returns the exception table of the method.

public void
forEachElement(Consumer<CodeElement>
the handler
consumer
)

Implements java.lang.classfile.CompoundElement.forEachElement.

Invoke the provided handler with each element contained in this compound element

private void
private void
public Label
private void
private void
inflateLabel(int bci)

private void
private void
private void
public void
public int
labelToBci(Label
a marker for a position within this CodeAttribute
label
)

Implements jdk.internal.classfile.impl.LabelContext.labelToBci, java.lang.classfile.attribute.CodeAttribute.labelToBci.

Returns the position of the Label in the codeArray or -1 if the Label does not point to the codeArray.

public Label
public Optional<MethodModel>
parent()

Implements java.lang.classfile.CodeModel.parent.

Returns the enclosing method, if known.

public void
public String
toString()

Overrides jdk.internal.classfile.impl.BoundAttribute.toString.

Returns a string representation of the object.

public void
writeTo(BufWriter
the writer
buf
)

Overrides jdk.internal.classfile.impl.BoundAttribute.writeTo.

Implements java.lang.classfile.WritableElement.writeTo.

Writes the element to the specified writer

Inherited from jdk.internal.classfile.impl.BoundAttribute.BoundCodeAttribute:
codeArraycodeLengthmaxLocalsmaxStack

Field Detail

attributesback to summary
pack-priv List<Attribute<?>> attributes
exceptionTableback to summary
pack-priv List<ExceptionCatch> exceptionTable
inflatedback to summary
pack-priv boolean inflated
labelsback to summary
pack-priv LabelImpl[] labels
lineNumbersback to summary
pack-priv int[] lineNumbers
SINGLETON_INSTRUCTIONSback to summary
pack-priv static final Instruction[] SINGLETON_INSTRUCTIONS

Constructor Detail

CodeImplback to summary
public CodeImpl(AttributedElement enclosing, ClassReader reader, AttributeMapper<CodeAttribute> mapper, int payloadStart)

Method Detail

adjustForObjectOrUninitializedback to summary
private int adjustForObjectOrUninitialized(int bci)
attributesback to summary
public List<Attribute<?>> attributes()

Implements java.lang.classfile.AttributedElement.attributes.

Doc from java.lang.classfile.AttributedElement.attributes.

Returns the attributes of this element.

Returns:List<Attribute<?>>

the attributes of this element

Annotations
@Override
bcToInstructionback to summary
private Instruction bcToInstruction(int bc, int pos)
compareCodeBytesback to summary
public boolean compareCodeBytes(BufWriter buf, int offset, int len)
exceptionHandlersback to summary
public List<ExceptionCatch> exceptionHandlers()

Implements java.lang.classfile.CodeModel.exceptionHandlers.

Doc from java.lang.classfile.CodeModel.exceptionHandlers.

Returns the exception table of the method. The exception table is also modeled by ExceptionCatch elements in the streaming view.

Returns:List<ExceptionCatch>

the exception table of the method

Annotations
@Override
forEachElementback to summary
public void forEachElement(Consumer<CodeElement> consumer)

Implements java.lang.classfile.CompoundElement.forEachElement.

Doc from java.lang.classfile.CompoundElement.forEachElement.

Invoke the provided handler with each element contained in this compound element

Parameters
consumer:Consumer<CodeElement>

the handler

Annotations
@Override
generateCatchTargetsback to summary
private void generateCatchTargets(Consumer<CodeElement> consumer)
generateDebugElementsback to summary
private void generateDebugElements(Consumer<CodeElement> consumer)
getLabelback to summary
public Label getLabel(int bci)

Implements jdk.internal.classfile.impl.LabelContext.getLabel.

Annotations
@Override
inflateJumpTargetsback to summary
private void inflateJumpTargets()
inflateLabelback to summary
private void inflateLabel(int bci)
inflateLineNumbersback to summary
private void inflateLineNumbers()
inflateMetadataback to summary
private void inflateMetadata()
inflateTypeAnnotationsback to summary
private void inflateTypeAnnotations()
iterateExceptionHandlersback to summary
public void iterateExceptionHandlers(CodeImpl.ExceptionHandlerAction a)
labelToBciback to summary
public int labelToBci(Label label)

Implements jdk.internal.classfile.impl.LabelContext.labelToBci, java.lang.classfile.attribute.CodeAttribute.labelToBci.

Doc from java.lang.classfile.attribute.CodeAttribute.labelToBci.

Returns the position of the Label in the codeArray or -1 if the Label does not point to the codeArray.

Parameters
label:Label

a marker for a position within this CodeAttribute

Returns:int

the position of the Label in the codeArray or -1 if the Label does not point to the codeArray

Annotations
@Override
newLabelback to summary
public Label newLabel()

Implements jdk.internal.classfile.impl.LabelContext.newLabel.

Annotations
@Override
parentback to summary
public Optional<MethodModel> parent()

Implements java.lang.classfile.CodeModel.parent.

Doc from java.lang.classfile.CodeModel.parent.

Returns the enclosing method, if known.

Returns:Optional<MethodModel>

the enclosing method, if known

Annotations
@Override
setLabelTargetback to summary
public void setLabelTarget(Label label, int bci)

Implements jdk.internal.classfile.impl.LabelContext.setLabelTarget.

Annotations
@Override
toStringback to summary
public String toString()

Overrides jdk.internal.classfile.impl.BoundAttribute.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
writeToback to summary
public void writeTo(BufWriter buf)

Overrides jdk.internal.classfile.impl.BoundAttribute.writeTo.

Implements java.lang.classfile.WritableElement.writeTo.

Doc from java.lang.classfile.WritableElement.writeTo.

Writes the element to the specified writer

Parameters
buf:BufWriter

the writer

Annotations
@Override
jdk.internal.classfile.impl back to summary

public Interface CodeImpl.ExceptionHandlerAction


Method Summary

Modifier and TypeMethod and Description
public void
accept(int start, int end, int handler, int catchTypeIndex)

Method Detail

acceptback to summary
public void accept(int start, int end, int handler, int catchTypeIndex)