APIdia Launch Partner
Top Inners Fields Constructors Methods
jdk.internal.classfile.impl

public final Class ClassFileImpl

extends Object
implements ClassFile
Class Inheritance
All Implemented Interfaces
java.lang.classfile.ClassFile
Imports
java.lang.classfile.AttributeMapper, .ClassBuilder, .ClassFile, .ClassHierarchyResolver, .ClassModel, .ClassTransform, java.lang.classfile.constantpool.ClassEntry, .ConstantPoolBuilder, .Utf8Entry, java.util.List, java.util.function.Consumer, .Function, jdk.internal.classfile.impl.verifier.VerifierImpl

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record
public static record

Field Summary

Modifier and TypeField and Description
private ClassFile.Option
private ClassFile.Option
private ClassFile.Option
private ClassFile.Option
private ClassFile.Option
private ClassFile.Option
private ClassFile.Option
public static final ClassFileImpl
private ClassFile.Option
private ClassFile.Option
private ClassFile.Option

Constructor Summary

AccessConstructor and Description
private
ClassFileImpl(ClassFile.Option stackMapsOption, ClassFile.Option debugElementsOption, ClassFile.Option lineNumbersOption, ClassFile.Option attributesProcessingOption, ClassFile.Option constantPoolSharingOption, ClassFile.Option shortJumpsOption, ClassFile.Option deadCodeOption, ClassFile.Option deadLabelsOption, ClassFile.Option classHierarchyResolverOption, ClassFile.Option attributeMapperOption)

Method Summary

Modifier and TypeMethod and Description
public Function<Utf8Entry, AttributeMapper<?>>
public ClassFile.AttributesProcessingOption
public byte[]
build(ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler)

Implements java.lang.classfile.ClassFile.build.

Builds a class file into a byte array using the provided constant pool builder.

public ClassHierarchyResolver
public boolean
public boolean
public boolean
public boolean
public ClassModel
parse(byte[] bytes)

Implements java.lang.classfile.ClassFile.parse.

Parses a class file into a ClassModel.

public boolean
public boolean
public boolean
public boolean
public boolean
public byte[]
transformClass(ClassModel model, ClassEntry newClassName, ClassTransform transform)

Implements java.lang.classfile.ClassFile.transformClass.

Transform one class file into a new class file according to a ClassTransform.

public List<VerifyError>
verify(ClassModel model)

Implements java.lang.classfile.ClassFile.verify.

Verify a class file.

public List<VerifyError>
verify(byte[] bytes)

Implements java.lang.classfile.ClassFile.verify.

Verify a class file.

public ClassFileImpl
withOptions(ClassFile.Option... options)

Implements java.lang.classfile.ClassFile.withOptions.

Returns a context with altered options from this context.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeMapperOptionback to summary
private ClassFile.Option attributeMapperOption
attributesProcessingOptionback to summary
private ClassFile.Option attributesProcessingOption
classHierarchyResolverOptionback to summary
private ClassFile.Option classHierarchyResolverOption
constantPoolSharingOptionback to summary
private ClassFile.Option constantPoolSharingOption
deadCodeOptionback to summary
private ClassFile.Option deadCodeOption
deadLabelsOptionback to summary
private ClassFile.Option deadLabelsOption
debugElementsOptionback to summary
private ClassFile.Option debugElementsOption
DEFAULT_CONTEXTback to summary
public static final ClassFileImpl DEFAULT_CONTEXT
lineNumbersOptionback to summary
private ClassFile.Option lineNumbersOption
shortJumpsOptionback to summary
private ClassFile.Option shortJumpsOption
stackMapsOptionback to summary
private ClassFile.Option stackMapsOption

Constructor Detail

ClassFileImplback to summary
private ClassFileImpl(ClassFile.Option stackMapsOption, ClassFile.Option debugElementsOption, ClassFile.Option lineNumbersOption, ClassFile.Option attributesProcessingOption, ClassFile.Option constantPoolSharingOption, ClassFile.Option shortJumpsOption, ClassFile.Option deadCodeOption, ClassFile.Option deadLabelsOption, ClassFile.Option classHierarchyResolverOption, ClassFile.Option attributeMapperOption)

Method Detail

attributeMapperback to summary
public Function<Utf8Entry, AttributeMapper<?>> attributeMapper()
attributesProcessingOptionback to summary
public ClassFile.AttributesProcessingOption attributesProcessingOption()
buildback to summary
public byte[] build(ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler)

Implements java.lang.classfile.ClassFile.build.

Doc from java.lang.classfile.ClassFile.build.

Builds a class file into a byte array using the provided constant pool builder.

Annotations
@Override
classHierarchyResolverback to summary
public ClassHierarchyResolver classHierarchyResolver()
dropDeadLabelsback to summary
public boolean dropDeadLabels()
dropStackMapsback to summary
public boolean dropStackMaps()
fixShortJumpsback to summary
public boolean fixShortJumps()
generateStackMapsback to summary
public boolean generateStackMaps()
parseback to summary
public ClassModel parse(byte[] bytes)

Implements java.lang.classfile.ClassFile.parse.

Doc from java.lang.classfile.ClassFile.parse.

Parses a class file into a ClassModel.

Due to the on-demand nature of class file parsing, an IllegalArgumentException may be thrown on any accessor method invocation on the returned model or any structure returned by the accessors in the structure hierarchy.

Annotations
@Override
passDebugElementsback to summary
public boolean passDebugElements()
passLineNumbersback to summary
public boolean passLineNumbers()
patchDeadCodeback to summary
public boolean patchDeadCode()
sharedConstantPoolback to summary
public boolean sharedConstantPool()
stackMapsWhenRequiredback to summary
public boolean stackMapsWhenRequired()
transformClassback to summary
public byte[] transformClass(ClassModel model, ClassEntry newClassName, ClassTransform transform)

Implements java.lang.classfile.ClassFile.transformClass.

Doc from java.lang.classfile.ClassFile.transformClass.

Transform one class file into a new class file according to a ClassTransform. The transform will receive each element of this class, as well as a ClassBuilder for building the new class. The transform is free to preserve, remove, or replace elements as it sees fit.

This method behaves as if:

ConstantPoolBuilder cpb = null; this.build(newClassName, cpb, clb -> clb.transform(model, transform));
ConstantPoolBuilder cpb = ...
this.build(newClassName, cpb, clb -> clb.transform(model, transform));
where cpb is determined by ConstantPoolSharingOption.
Annotations
@Override
verifyback to summary
public List<VerifyError> verify(ClassModel model)

Implements java.lang.classfile.ClassFile.verify.

Doc from java.lang.classfile.ClassFile.verify.

Verify a class file. All verification errors found will be returned.

Annotations
@Override
verifyback to summary
public List<VerifyError> verify(byte[] bytes)

Implements java.lang.classfile.ClassFile.verify.

Doc from java.lang.classfile.ClassFile.verify.

Verify a class file. All verification errors found will be returned.

Annotations
@Override
withOptionsback to summary
public ClassFileImpl withOptions(ClassFile.Option... options)

Implements java.lang.classfile.ClassFile.withOptions.

Doc from java.lang.classfile.ClassFile.withOptions.

Returns a context with altered options from this context.

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

public final Record ClassFileImpl.AttributeMapperOptionImpl

extends Record
implements AttributeMapperOption
Class Inheritance
All Implemented Interfaces
java.lang.classfile.ClassFile.AttributeMapperOption, java.lang.classfile.ClassFile.Option
Record Components
attributeMapper:Function<Utf8Entry, AttributeMapper<?>> 

Field Summary

Modifier and TypeField and Description
private final Function<Utf8Entry, AttributeMapper<?>>
attributeMapper

Record Component accessed by attributeMapper().

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Function<Utf8Entry, AttributeMapper<?>>
attributeMapper()

Record Component getter of attributeMapper.

Implements java.lang.classfile.ClassFile.AttributeMapperOption.attributeMapper.

Returns the function mapping attribute names to attribute mappers.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

attributeMapperback to summary
private final Function<Utf8Entry, AttributeMapper<?>> attributeMapper

Record Component accessed by attributeMapper().

Constructor Detail

AttributeMapperOptionImplback to summary
public AttributeMapperOptionImpl(Function<Utf8Entry, AttributeMapper<?>> attributeMapper)

Method Detail

attributeMapperback to summary
public Function<Utf8Entry, AttributeMapper<?>> attributeMapper()

Record Component getter of attributeMapper.

Implements java.lang.classfile.ClassFile.AttributeMapperOption.attributeMapper.

Doc from java.lang.classfile.ClassFile.AttributeMapperOption.attributeMapper.

Returns the function mapping attribute names to attribute mappers.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

jdk.internal.classfile.impl back to summary

public final Record ClassFileImpl.ClassHierarchyResolverOptionImpl

extends Record
implements ClassHierarchyResolverOption
Class Inheritance
All Implemented Interfaces
java.lang.classfile.ClassFile.ClassHierarchyResolverOption, java.lang.classfile.ClassFile.Option
Record Components
classHierarchyResolver:ClassHierarchyResolver 

Field Summary

Modifier and TypeField and Description
private final ClassHierarchyResolver
classHierarchyResolver

Record Component accessed by classHierarchyResolver().

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ClassHierarchyResolver
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

classHierarchyResolverback to summary
private final ClassHierarchyResolver classHierarchyResolver

Record Component accessed by classHierarchyResolver().

Constructor Detail

ClassHierarchyResolverOptionImplback to summary
public ClassHierarchyResolverOptionImpl(ClassHierarchyResolver classHierarchyResolver)

Method Detail

classHierarchyResolverback to summary
public ClassHierarchyResolver classHierarchyResolver()

Record Component getter of classHierarchyResolver.

Implements java.lang.classfile.ClassFile.ClassHierarchyResolverOption.classHierarchyResolver.

Doc from java.lang.classfile.ClassFile.ClassHierarchyResolverOption.classHierarchyResolver.

Returns the class hierarchy resolver.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.