java.lang.Object
org.glavo.classfile.impl.AbstractElement
org.glavo.classfile.impl.BoundAttribute<CodeAttribute>
org.glavo.classfile.impl.BoundAttribute.BoundCodeAttribute
org.glavo.classfile.impl.CodeImpl
- All Implemented Interfaces:
Iterable<CodeElement>,Attribute<CodeAttribute>,CodeAttribute,AttributedElement,ClassFileElement,CodeModel,CompoundElement<CodeElement>,LabelContext,MethodElement,WritableElement<CodeAttribute>
public final class CodeImpl
extends BoundAttribute.BoundCodeAttribute
implements CodeModel, LabelContext
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.glavo.classfile.impl.BoundAttribute
BoundAttribute.BoundAnnotationDefaultAttr, BoundAttribute.BoundBootstrapMethodsAttribute, BoundAttribute.BoundCharacterRangeTableAttribute, BoundAttribute.BoundCodeAttribute, BoundAttribute.BoundCompilationIDAttribute, BoundAttribute.BoundConstantValueAttribute, BoundAttribute.BoundDeprecatedAttribute, BoundAttribute.BoundEnclosingMethodAttribute, BoundAttribute.BoundExceptionsAttribute, BoundAttribute.BoundInnerClassesAttribute, BoundAttribute.BoundLineNumberTableAttribute, BoundAttribute.BoundLocalVariableTableAttribute, BoundAttribute.BoundLocalVariableTypeTableAttribute, BoundAttribute.BoundMethodParametersAttribute, BoundAttribute.BoundModuleAttribute, BoundAttribute.BoundModuleHashesAttribute, BoundAttribute.BoundModuleMainClassAttribute, BoundAttribute.BoundModulePackagesAttribute, BoundAttribute.BoundModuleResolutionAttribute, BoundAttribute.BoundModuleTargetAttribute, BoundAttribute.BoundNestHostAttribute, BoundAttribute.BoundNestMembersAttribute, BoundAttribute.BoundPermittedSubclassesAttribute, BoundAttribute.BoundRecordAttribute, BoundAttribute.BoundRuntimeInvisibleAnnotationsAttribute, BoundAttribute.BoundRuntimeInvisibleParameterAnnotationsAttribute, BoundAttribute.BoundRuntimeInvisibleTypeAnnotationsAttribute, BoundAttribute.BoundRuntimeVisibleAnnotationsAttribute, BoundAttribute.BoundRuntimeVisibleParameterAnnotationsAttribute, BoundAttribute.BoundRuntimeVisibleTypeAnnotationsAttribute, BoundAttribute.BoundSignatureAttribute, BoundAttribute.BoundSourceDebugExtensionAttribute, BoundAttribute.BoundSourceFileAttribute, BoundAttribute.BoundSourceIDAttribute, BoundAttribute.BoundStackMapTableAttribute, BoundAttribute.BoundSyntheticAttribute, BoundAttribute.BoundUnknownAttribute -
Field Summary
Fields inherited from class org.glavo.classfile.impl.BoundAttribute.BoundCodeAttribute
attributePos, codeEnd, codeLength, codeStart, enclosingMethod, exceptionHandlerCnt, exceptionHandlerPos -
Constructor Summary
ConstructorsConstructorDescriptionCodeImpl(AttributedElement enclosing, ClassReader reader, AttributeMapper<CodeAttribute> mapper, int payloadStart) -
Method Summary
Modifier and TypeMethodDescriptionReturns the attributes of this element.booleancompareCodeBytes(BufWriter buf, int offset, int len) Returns the exception table of the method.voidforEachElement(Consumer<CodeElement> consumer) Invoke the provided handler with each element contained in this compound elementgetLabel(int bci) voidintlabelToBci(Label label) Returns the position of theLabelin thecodeArrayor -1 if theLabeldoes not point to thecodeArray.newLabel()parent()Returns the enclosing method, if known.voidsetLabelTarget(Label label, int bci) toString()voidWrites the element to the specified writerMethods inherited from class org.glavo.classfile.impl.BoundAttribute.BoundCodeAttribute
codeArray, codeLength, maxLocals, maxStackMethods inherited from class org.glavo.classfile.impl.BoundAttribute
attributeMapper, attributeName, constantPool, contents, payloadLen, readAttributes, writeTo, writeTo, writeTo, writeToMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.glavo.classfile.Attribute
attributeMapper, attributeNameMethods inherited from interface org.glavo.classfile.AttributedElement
findAttribute, findAttributesMethods inherited from interface org.glavo.classfile.CompoundElement
elementList, elements, elementStream, iteratorMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CodeImpl
public CodeImpl(AttributedElement enclosing, ClassReader reader, AttributeMapper<CodeAttribute> mapper, int payloadStart)
-
-
Method Details
-
newLabel
- Specified by:
newLabelin interfaceLabelContext
-
setLabelTarget
- Specified by:
setLabelTargetin interfaceLabelContext
-
getLabel
- Specified by:
getLabelin interfaceLabelContext
-
labelToBci
Description copied from interface:CodeAttributeReturns the position of theLabelin thecodeArrayor -1 if theLabeldoes not point to thecodeArray.- Specified by:
labelToBciin interfaceCodeAttribute- Specified by:
labelToBciin interfaceLabelContext- Parameters:
label- a marker for a position within thisCodeAttribute- Returns:
- the position of the
Labelin thecodeArrayor -1 if theLabeldoes not point to thecodeArray
-
attributes
Description copied from interface:AttributedElementReturns the attributes of this element.- Specified by:
attributesin interfaceAttributedElement- Returns:
- the attributes of this element
-
writeTo
Description copied from interface:WritableElementWrites the element to the specified writer- Specified by:
writeToin interfaceWritableElement<CodeAttribute>- Overrides:
writeToin classBoundAttribute<CodeAttribute>- Parameters:
buf- the writer
-
parent
Description copied from interface:CodeModelReturns the enclosing method, if known. -
forEachElement
Description copied from interface:CompoundElementInvoke the provided handler with each element contained in this compound element- Specified by:
forEachElementin interfaceCompoundElement<CodeElement>- Parameters:
consumer- the handler
-
exceptionHandlers
Description copied from interface:CodeModelReturns the exception table of the method. The exception table is also modeled byExceptionCatchelements in the streaming view.- Specified by:
exceptionHandlersin interfaceCodeModel- Returns:
- the exception table of the method
-
compareCodeBytes
-
iterateExceptionHandlers
-
toString
- Overrides:
toStringin classBoundAttribute<CodeAttribute>
-