ClassFile (Java SE 25 & JDK 25)
Description: declaration: module: java.base, package: java.lang.classfile, interface: ClassFile
Keywords: java.lang.classfile.ClassFile interface

# Interface ClassFile

public sealed interface ClassFile
Provides ability to parse, transform, and generate `class` files. A `ClassFile` is a context with a set of options that condition how parsing and generation are done.

Since:
  24

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `ClassFile.AttributeMapperOption`
  The option describing user-defined attributes for parsing `class` files.
  `static enum`
  `ClassFile.AttributesProcessingOption`
  The option describing whether to retain or discard attributes that cannot verify their correctness after a transformation.
  `static interface`
  `ClassFile.ClassHierarchyResolverOption`
  The option describing the class hierarchy resolver to use when generating stack maps or verifying classes.
  `static enum`
  `ClassFile.ConstantPoolSharingOption`
  Option describing whether to extend from the original constant pool when transforming a `class` file.
  `static enum`
  `ClassFile.DeadCodeOption`
  The option describing whether to patch out unreachable code for stack map generation.
  `static enum`
  `ClassFile.DeadLabelsOption`
  The option describing whether to filter unbound labels and drop their enclosing structures if possible.
  `static enum`
  `ClassFile.DebugElementsOption`
  The option describing whether to process or discard debug `PseudoInstruction`s in the traversal of a `CodeModel` or a `CodeBuilder`.
  `static enum`
  `ClassFile.LineNumbersOption`
  The option describing whether to process or discard `LineNumber`s in the traversal of a `CodeModel` or a `CodeBuilder`.
  `static interface`
  `ClassFile.Option`
  An option that affects the parsing or writing of `class` files.
  `static enum`
  `ClassFile.ShortJumpsOption`
  The option describing whether to automatically rewrite short jumps to equivalent instructions when necessary.
  `static enum`
  `ClassFile.StackMapsOption`
  The option describing whether to generate stack maps.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `ACC_ABSTRACT`
  The bit mask of `AccessFlag.ABSTRACT` access and property modifier.
  `static final int`
  `ACC_ANNOTATION`
  The bit mask of `AccessFlag.ANNOTATION` access and property modifier.
  `static final int`
  `ACC_BRIDGE`
  The bit mask of `AccessFlag.BRIDGE` access and property modifier.
  `static final int`
  `ACC_ENUM`
  The bit mask of `AccessFlag.ENUM` access and property modifier.
  `static final int`
  `ACC_FINAL`
  The bit mask of `AccessFlag.FINAL` access and property modifier.
  `static final int`
  `ACC_INTERFACE`
  The bit mask of `AccessFlag.INTERFACE` access and property modifier.
  `static final int`
  `ACC_MANDATED`
  The bit mask of `AccessFlag.MANDATED` access and property modifier.
  `static final int`
  `ACC_MODULE`
  The bit mask of `AccessFlag.MODULE` access and property modifier.
  `static final int`
  `ACC_NATIVE`
  The bit mask of `AccessFlag.NATIVE` access and property modifier.
  `static final int`
  `ACC_OPEN`
  The bit mask of `AccessFlag.OPEN` access and property modifier.
  `static final int`
  `ACC_PRIVATE`
  The bit mask of `AccessFlag.PRIVATE` access and property modifier.
  `static final int`
  `ACC_PROTECTED`
  The bit mask of `AccessFlag.PROTECTED` access and property modifier.
  `static final int`
  `ACC_PUBLIC`
  The bit mask of `AccessFlag.PUBLIC` access and property modifier.
  `static final int`
  `ACC_STATIC`
  The bit mask of `AccessFlag.STATIC` access and property modifier.
  `static final int`
  `ACC_STATIC_PHASE`
  The bit mask of `AccessFlag.STATIC_PHASE` access and property modifier.
  `static final int`
  `ACC_STRICT`
  The bit mask of `AccessFlag.STRICT` access and property modifier.
  `static final int`
  `ACC_SUPER`
  The bit mask of `AccessFlag.SUPER` access and property modifier.
  `static final int`
  `ACC_SYNCHRONIZED`
  The bit mask of `AccessFlag.SYNCHRONIZED` access and property modifier.
  `static final int`
  `ACC_SYNTHETIC`
  The bit mask of `AccessFlag.SYNTHETIC` access and property modifier.
  `static final int`
  `ACC_TRANSIENT`
  The bit mask of `AccessFlag.TRANSIENT` access and property modifier.
  `static final int`
  `ACC_TRANSITIVE`
  The bit mask of `AccessFlag.TRANSITIVE` access and property modifier.
  `static final int`
  `ACC_VARARGS`
  The bit mask of `AccessFlag.VARARGS` access and property modifier.
  `static final int`
  `ACC_VOLATILE`
  The bit mask of `AccessFlag.VOLATILE` access and property modifier.
  `static final int`
  `JAVA_1_VERSION`
  The class major version of the initial version of Java, 45.
  `static final int`
  `JAVA_10_VERSION`
  The class major version introduced by Java SE 10, 54.
  `static final int`
  `JAVA_11_VERSION`
  The class major version introduced by Java SE 11, 55.
  `static final int`
  `JAVA_12_VERSION`
  The class major version introduced by Java SE 12, 56.
  `static final int`
  `JAVA_13_VERSION`
  The class major version introduced by Java SE 13, 57.
  `static final int`
  `JAVA_14_VERSION`
  The class major version introduced by Java SE 14, 58.
  `static final int`
  `JAVA_15_VERSION`
  The class major version introduced by Java SE 15, 59.
  `static final int`
  `JAVA_16_VERSION`
  The class major version introduced by Java SE 16, 60.
  `static final int`
  `JAVA_17_VERSION`
  The class major version introduced by Java SE 17, 61.
  `static final int`
  `JAVA_18_VERSION`
  The class major version introduced by Java SE 18, 62.
  `static final int`
  `JAVA_19_VERSION`
  The class major version introduced by Java SE 19, 63.
  `static final int`
  `JAVA_2_VERSION`
  The class major version introduced by Java 2 SE 1.2, 46.
  `static final int`
  `JAVA_20_VERSION`
  The class major version introduced by Java SE 20, 64.
  `static final int`
  `JAVA_21_VERSION`
  The class major version introduced by Java SE 21, 65.
  `static final int`
  `JAVA_22_VERSION`
  The class major version introduced by Java SE 22, 66.
  `static final int`
  `JAVA_23_VERSION`
  The class major version introduced by Java SE 23, 67.
  `static final int`
  `JAVA_24_VERSION`
  The class major version introduced by Java SE 24, 68.
  `static final int`
  `JAVA_25_VERSION`
  The class major version introduced by Java SE 25, 69.
  `static final int`
  `JAVA_3_VERSION`
  The class major version introduced by Java 2 SE 1.3, 47.
  `static final int`
  `JAVA_4_VERSION`
  The class major version introduced by Java 2 SE 1.4, 48.
  `static final int`
  `JAVA_5_VERSION`
  The class major version introduced by Java 2 SE 5.0, 49.
  `static final int`
  `JAVA_6_VERSION`
  The class major version introduced by Java SE 6, 50.
  `static final int`
  `JAVA_7_VERSION`
  The class major version introduced by Java SE 7, 51.
  `static final int`
  `JAVA_8_VERSION`
  The class major version introduced by Java SE 8, 52.
  `static final int`
  `JAVA_9_VERSION`
  The class major version introduced by Java SE 9, 53.
  `static final int`
  `MAGIC_NUMBER`
  The magic number identifying the `class` file format, 0xcafebabe.
  `static final int`
  `PREVIEW_MINOR_VERSION`
  A minor version number 65535 indicating a class uses preview features of a Java SE release since 12, for major versions 56 and above.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `byte[]`
  `build(ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler)`
  Builds a `class` file into a byte array using the provided constant pool builder.
  `default byte[]`
  `build(ClassDesc thisClass, Consumer<? super ClassBuilder> handler)`
  Builds a `class` file into a byte array.
  `default byte[]`
  `buildModule(ModuleAttribute moduleAttribute)`
  Builds a module descriptor into a byte array.
  `default byte[]`
  `buildModule(ModuleAttribute moduleAttribute, Consumer<? super ClassBuilder> handler)`
  Builds a module descriptor into a byte array.
  `default void`
  `buildModuleTo(Path path, ModuleAttribute moduleAttribute)`
  Builds a module descriptor into a file in a file system.
  `default void`
  `buildModuleTo(Path path, ModuleAttribute moduleAttribute, Consumer<? super ClassBuilder> handler)`
  Builds a module descriptor into a file in a file system.
  `default void`
  `buildTo(Path path, ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler)`
  Builds a `class` file into a file in a file system using the provided constant pool builder.
  `default void`
  `buildTo(Path path, ClassDesc thisClass, Consumer<ClassBuilder> handler)`
  Builds a `class` file into a file in a file system.
  `static int`
  `latestMajorVersion()`
  Returns the latest class major version supported by the current runtime.
  `static int`
  `latestMinorVersion()`
  Returns the latest class minor version supported by the current runtime.
  `static ClassFile`
  `of()`
  Returns a context with default options.
  `static ClassFile`
  `of(ClassFile.Option... options)`
  Returns a context with options altered from the default.
  `ClassModel`
  `parse(byte[] bytes)`
  Parses a `class` file into a `ClassModel`.
  `default ClassModel`
  `parse(Path path)`
  Parses a `class` into a `ClassModel`.
  `default byte[]`
  `transformClass(ClassModel model, ClassTransform transform)`
  Transform one `class` file into a new `class` file according to a `ClassTransform`.
  `byte[]`
  `transformClass(ClassModel model, ClassEntry newClassName, ClassTransform transform)`
  Transform one `class` file into a new `class` file according to a `ClassTransform`.
  `default byte[]`
  `transformClass(ClassModel model, ClassDesc newClassName, ClassTransform transform)`
  Transform one `class` file into a new `class` file according to a `ClassTransform`.
  `List<VerifyError>`
  `verify(byte[] bytes)`
  Verify a `class` file.
  `List<VerifyError>`
  `verify(ClassModel model)`
  Verify a `class` file.
  `default List<VerifyError>`
  `verify(Path path)`
  Verify a `class` file.
  `ClassFile`
  `withOptions(ClassFile.Option... options)`
  Returns a context with altered options from this context.

- ## Field Details

  - ### MAGIC_NUMBER

    static final int MAGIC_NUMBER
    The magic number identifying the `class` file format, 0xcafebabe. It is a big-endian 4-byte value.
    See Also:
      - Constant Field Values

  - ### ACC_PUBLIC

    static final int ACC_PUBLIC
    The bit mask of `AccessFlag.PUBLIC` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_PROTECTED

    static final int ACC_PROTECTED
    The bit mask of `AccessFlag.PROTECTED` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_PRIVATE

    static final int ACC_PRIVATE
    The bit mask of `AccessFlag.PRIVATE` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_INTERFACE

    static final int ACC_INTERFACE
    The bit mask of `AccessFlag.INTERFACE` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_ENUM

    static final int ACC_ENUM
    The bit mask of `AccessFlag.ENUM` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_ANNOTATION

    static final int ACC_ANNOTATION
    The bit mask of `AccessFlag.ANNOTATION` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_SUPER

    static final int ACC_SUPER
    The bit mask of `AccessFlag.SUPER` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_ABSTRACT

    static final int ACC_ABSTRACT
    The bit mask of `AccessFlag.ABSTRACT` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_VOLATILE

    static final int ACC_VOLATILE
    The bit mask of `AccessFlag.VOLATILE` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_TRANSIENT

    static final int ACC_TRANSIENT
    The bit mask of `AccessFlag.TRANSIENT` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_SYNTHETIC

    static final int ACC_SYNTHETIC
    The bit mask of `AccessFlag.SYNTHETIC` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_STATIC

    static final int ACC_STATIC
    The bit mask of `AccessFlag.STATIC` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_FINAL

    static final int ACC_FINAL
    The bit mask of `AccessFlag.FINAL` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_SYNCHRONIZED

    static final int ACC_SYNCHRONIZED
    The bit mask of `AccessFlag.SYNCHRONIZED` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_BRIDGE

    static final int ACC_BRIDGE
    The bit mask of `AccessFlag.BRIDGE` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_VARARGS

    static final int ACC_VARARGS
    The bit mask of `AccessFlag.VARARGS` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_NATIVE

    static final int ACC_NATIVE
    The bit mask of `AccessFlag.NATIVE` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_STRICT

    static final int ACC_STRICT
    The bit mask of `AccessFlag.STRICT` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_MODULE

    static final int ACC_MODULE
    The bit mask of `AccessFlag.MODULE` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_OPEN

    static final int ACC_OPEN
    The bit mask of `AccessFlag.OPEN` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_MANDATED

    static final int ACC_MANDATED
    The bit mask of `AccessFlag.MANDATED` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_TRANSITIVE

    static final int ACC_TRANSITIVE
    The bit mask of `AccessFlag.TRANSITIVE` access and property modifier.
    See Also:
      - Constant Field Values

  - ### ACC_STATIC_PHASE

    static final int ACC_STATIC_PHASE
    The bit mask of `AccessFlag.STATIC_PHASE` access and property modifier.
    See Also:
      - Constant Field Values

  - ### JAVA_1_VERSION

    static final int JAVA_1_VERSION
    The class major version of the initial version of Java, 45.
    See Also:
      - `ClassFileFormatVersion.RELEASE_0`
      - `ClassFileFormatVersion.RELEASE_1`
      - Constant Field Values

  - ### JAVA_2_VERSION

    static final int JAVA_2_VERSION
    The class major version introduced by Java 2 SE 1.2, 46.
    See Also:
      - `ClassFileFormatVersion.RELEASE_2`
      - Constant Field Values

  - ### JAVA_3_VERSION

    static final int JAVA_3_VERSION
    The class major version introduced by Java 2 SE 1.3, 47.
    See Also:
      - `ClassFileFormatVersion.RELEASE_3`
      - Constant Field Values

  - ### JAVA_4_VERSION

    static final int JAVA_4_VERSION
    The class major version introduced by Java 2 SE 1.4, 48.
    See Also:
      - `ClassFileFormatVersion.RELEASE_4`
      - Constant Field Values

  - ### JAVA_5_VERSION

    static final int JAVA_5_VERSION
    The class major version introduced by Java 2 SE 5.0, 49.
    See Also:
      - `ClassFileFormatVersion.RELEASE_5`
      - Constant Field Values

  - ### JAVA_6_VERSION

    static final int JAVA_6_VERSION
    The class major version introduced by Java SE 6, 50.
    See Also:
      - `ClassFileFormatVersion.RELEASE_6`
      - Constant Field Values

  - ### JAVA_7_VERSION

    static final int JAVA_7_VERSION
    The class major version introduced by Java SE 7, 51.
    See Also:
      - `ClassFileFormatVersion.RELEASE_7`
      - Constant Field Values

  - ### JAVA_8_VERSION

    static final int JAVA_8_VERSION
    The class major version introduced by Java SE 8, 52.
    See Also:
      - `ClassFileFormatVersion.RELEASE_8`
      - Constant Field Values

  - ### JAVA_9_VERSION

    static final int JAVA_9_VERSION
    The class major version introduced by Java SE 9, 53.
    See Also:
      - `ClassFileFormatVersion.RELEASE_9`
      - Constant Field Values

  - ### JAVA_10_VERSION

    static final int JAVA_10_VERSION
    The class major version introduced by Java SE 10, 54.
    See Also:
      - `ClassFileFormatVersion.RELEASE_10`
      - Constant Field Values

  - ### JAVA_11_VERSION

    static final int JAVA_11_VERSION
    The class major version introduced by Java SE 11, 55.
    See Also:
      - `ClassFileFormatVersion.RELEASE_11`
      - Constant Field Values

  - ### JAVA_12_VERSION

    static final int JAVA_12_VERSION
    The class major version introduced by Java SE 12, 56.
    See Also:
      - `ClassFileFormatVersion.RELEASE_12`
      - Constant Field Values

  - ### JAVA_13_VERSION

    static final int JAVA_13_VERSION
    The class major version introduced by Java SE 13, 57.
    See Also:
      - `ClassFileFormatVersion.RELEASE_13`
      - Constant Field Values

  - ### JAVA_14_VERSION

    static final int JAVA_14_VERSION
    The class major version introduced by Java SE 14, 58.
    See Also:
      - `ClassFileFormatVersion.RELEASE_14`
      - Constant Field Values

  - ### JAVA_15_VERSION

    static final int JAVA_15_VERSION
    The class major version introduced by Java SE 15, 59.
    See Also:
      - `ClassFileFormatVersion.RELEASE_15`
      - Constant Field Values

  - ### JAVA_16_VERSION

    static final int JAVA_16_VERSION
    The class major version introduced by Java SE 16, 60.
    See Also:
      - `ClassFileFormatVersion.RELEASE_16`
      - Constant Field Values

  - ### JAVA_17_VERSION

    static final int JAVA_17_VERSION
    The class major version introduced by Java SE 17, 61.
    See Also:
      - `ClassFileFormatVersion.RELEASE_17`
      - Constant Field Values

  - ### JAVA_18_VERSION

    static final int JAVA_18_VERSION
    The class major version introduced by Java SE 18, 62.
    See Also:
      - `ClassFileFormatVersion.RELEASE_18`
      - Constant Field Values

  - ### JAVA_19_VERSION

    static final int JAVA_19_VERSION
    The class major version introduced by Java SE 19, 63.
    See Also:
      - `ClassFileFormatVersion.RELEASE_19`
      - Constant Field Values

  - ### JAVA_20_VERSION

    static final int JAVA_20_VERSION
    The class major version introduced by Java SE 20, 64.
    See Also:
      - `ClassFileFormatVersion.RELEASE_20`
      - Constant Field Values

  - ### JAVA_21_VERSION

    static final int JAVA_21_VERSION
    The class major version introduced by Java SE 21, 65.
    See Also:
      - `ClassFileFormatVersion.RELEASE_21`
      - Constant Field Values

  - ### JAVA_22_VERSION

    static final int JAVA_22_VERSION
    The class major version introduced by Java SE 22, 66.
    See Also:
      - `ClassFileFormatVersion.RELEASE_22`
      - Constant Field Values

  - ### JAVA_23_VERSION

    static final int JAVA_23_VERSION
    The class major version introduced by Java SE 23, 67.
    See Also:
      - `ClassFileFormatVersion.RELEASE_23`
      - Constant Field Values

  - ### JAVA_24_VERSION

    static final int JAVA_24_VERSION
    The class major version introduced by Java SE 24, 68.
    See Also:
      - `ClassFileFormatVersion.RELEASE_24`
      - Constant Field Values

  - ### JAVA_25_VERSION

    static final int JAVA_25_VERSION
    The class major version introduced by Java SE 25, 69.
    Since:
      25
    See Also:
      - `ClassFileFormatVersion.RELEASE_25`
      - Constant Field Values

  - ### PREVIEW_MINOR_VERSION

    static final int PREVIEW_MINOR_VERSION
    A minor version number 65535 indicating a class uses preview features of a Java SE release since 12, for major versions 56 and above.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### of

    static ClassFile of()
    Returns a context with default options. Each subtype of `ClassFile.Option` specifies its default.

    The default `ClassFile.AttributeMapperOption` and `ClassFile.ClassHierarchyResolverOption` may be unsuitable for some `class` files and result in parsing or generation errors.

    Returns:
      a context with default options

  - ### of

    static ClassFile of(ClassFile.Option... options)
    Returns a context with options altered from the default. Equivalent to `ClassFile.of().withOptions(options)`.
    Parameters:
      `options` - the desired processing options
    Returns:
      a context with options altered from the default

  - ### withOptions

    ClassFile withOptions(ClassFile.Option... options)
    Returns a context with altered options from this context.
    Parameters:
      `options` - the desired processing options
    Returns:
      a context with altered options from this context

  - ### parse

    ClassModel parse(byte[] bytes)
    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.

    Parameters:
      `bytes` - the bytes of the `class` file
    Returns:
      the class model
    Throws:
      `IllegalArgumentException` - if the `class` file is malformed or of a version not supported by the current runtime

  - ### parse

    default ClassModel parse(Path path) throws IOException
    Parses a `class` 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.

    Parameters:
      `path` - the path to the `class` file
    Returns:
      the class model
    Throws:
      `IOException` - if an I/O error occurs
      `IllegalArgumentException` - if the `class` file is malformed or of a version not supported by the current runtime
    See Also:
      - `parse(byte[])`

  - ### build

    default byte[] build(ClassDesc thisClass, Consumer<? super ClassBuilder> handler)
    Builds a `class` file into a byte array.
    Parameters:
      `thisClass` - the name of the class to build
      `handler` - a handler that receives a `ClassBuilder`
    Returns:
      the `class` file bytes
    Throws:
      `IllegalArgumentException` - if `thisClass` represents a primitive type or building encounters a failure

  - ### build

    byte[] build(ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler)
    Builds a `class` file into a byte array using the provided constant pool builder.
    Parameters:
      `thisClassEntry` - the name of the class to build
      `constantPool` - the constant pool builder
      `handler` - a handler that receives a `ClassBuilder`
    Returns:
      the `class` file bytes
    Throws:
      `IllegalArgumentException` - if building encounters a failure

  - ### buildTo

    default void buildTo(Path path, ClassDesc thisClass, Consumer<ClassBuilder> handler) throws IOException
    Builds a `class` file into a file in a file system.
    Parameters:
      `path` - the path to the file to write
      `thisClass` - the name of the class to build
      `handler` - a handler that receives a `ClassBuilder`
    Throws:
      `IOException` - if an I/O error occurs
      `IllegalArgumentException` - if building encounters a failure

  - ### buildTo

    default void buildTo(Path path, ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler) throws IOException
    Builds a `class` file into a file in a file system using the provided constant pool builder.
    Parameters:
      `path` - the path to the file to write
      `thisClassEntry` - the name of the class to build
      `constantPool` - the constant pool builder
      `handler` - a handler that receives a `ClassBuilder`
    Throws:
      `IOException` - if an I/O error occurs
      `IllegalArgumentException` - if building encounters a failure

  - ### buildModule

    default byte[] buildModule(ModuleAttribute moduleAttribute)
    Builds a module descriptor into a byte array.
    Parameters:
      `moduleAttribute` - the `Module` attribute
    Returns:
      the `class` file bytes
    Throws:
      `IllegalArgumentException` - if building encounters a failure

  - ### buildModule

    default byte[] buildModule(ModuleAttribute moduleAttribute, Consumer<? super ClassBuilder> handler)
    Builds a module descriptor into a byte array.
    Parameters:
      `moduleAttribute` - the `Module` attribute
      `handler` - a handler that receives a `ClassBuilder`
    Returns:
      the `class` file bytes
    Throws:
      `IllegalArgumentException` - if building encounters a failure

  - ### buildModuleTo

    default void buildModuleTo(Path path, ModuleAttribute moduleAttribute) throws IOException
    Builds a module descriptor into a file in a file system.
    Parameters:
      `path` - the file to write
      `moduleAttribute` - the `Module` attribute
    Throws:
      `IOException` - if an I/O error occurs
      `IllegalArgumentException` - if building encounters a failure

  - ### buildModuleTo

    default void buildModuleTo(Path path, ModuleAttribute moduleAttribute, Consumer<? super ClassBuilder> handler) throws IOException
    Builds a module descriptor into a file in a file system.
    Parameters:
      `path` - the file to write
      `moduleAttribute` - the `Module` attribute
      `handler` - a handler that receives a `ClassBuilder`
    Throws:
      `IOException` - if an I/O error occurs
      `IllegalArgumentException` - if building encounters a failure

  - ### transformClass

    default byte[] transformClass(ClassModel model, ClassTransform transform)
    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 = ...
        this.build(model.thisClass(), cpb,
                   clb -> clb.transform(model, transform));

    where `cpb` is determined by `ClassFile.ConstantPoolSharingOption`.
    API Note:
      This is named `transformClass` instead of `transform` for consistency with `ClassBuilder.transformField(FieldModel, FieldTransform)`, `ClassBuilder.transformMethod(MethodModel, MethodTransform)`, and `MethodBuilder.transformCode(CodeModel, CodeTransform)`, and to distinguish from `ClassFileBuilder.transform(CompoundElement, ClassFileTransform)`, which is more generic and powerful.
    Parameters:
      `model` - the class model to transform
      `transform` - the transform
    Returns:
      the bytes of the new class
    Throws:
      `IllegalArgumentException` - if building encounters a failure
    See Also:
      - `ClassFile.ConstantPoolSharingOption`

  - ### transformClass

    default byte[] transformClass(ClassModel model, ClassDesc newClassName, ClassTransform transform)
    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.
    API Note:
      This is named `transformClass` instead of `transform` for consistency with `ClassBuilder.transformField(FieldModel, FieldTransform)`, `ClassBuilder.transformMethod(MethodModel, MethodTransform)`, and `MethodBuilder.transformCode(CodeModel, CodeTransform)`, and to distinguish from `ClassFileBuilder.transform(CompoundElement, ClassFileTransform)`, which is more generic and powerful.
    Parameters:
      `model` - the class model to transform
      `newClassName` - new class name
      `transform` - the transform
    Returns:
      the bytes of the new class
    Throws:
      `IllegalArgumentException` - if building encounters a failure
    See Also:
      - `ClassFile.ConstantPoolSharingOption`

  - ### transformClass

    byte[] transformClass(ClassModel model, ClassEntry newClassName, ClassTransform transform)
    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 = ...
        this.build(newClassName, cpb, clb -> clb.transform(model, transform));

    where `cpb` is determined by `ClassFile.ConstantPoolSharingOption`.
    API Note:
      This is named `transformClass` instead of `transform` for consistency with `ClassBuilder.transformField(FieldModel, FieldTransform)`, `ClassBuilder.transformMethod(MethodModel, MethodTransform)`, and `MethodBuilder.transformCode(CodeModel, CodeTransform)`, and to distinguish from `ClassFileBuilder.transform(CompoundElement, ClassFileTransform)`, which is more generic and powerful.
    Parameters:
      `model` - the class model to transform
      `newClassName` - new class name
      `transform` - the transform
    Returns:
      the bytes of the new class
    Throws:
      `IllegalArgumentException` - if building encounters a failure
    See Also:
      - `ClassFile.ConstantPoolSharingOption`

  - ### verify

    List<VerifyError> verify(ClassModel model)
    Verify a `class` file. All verification errors found will be returned.
    Parameters:
      `model` - the class model to verify
    Returns:
      a list of verification errors, or an empty list if no error is found

  - ### verify

    List<VerifyError> verify(byte[] bytes)
    Verify a `class` file. All verification errors found will be returned.
    Parameters:
      `bytes` - the `class` file bytes to verify
    Returns:
      a list of verification errors, or an empty list if no error is found

  - ### verify

    default List<VerifyError> verify(Path path) throws IOException
    Verify a `class` file. All verification errors found will be returned.
    Parameters:
      `path` - the `class` file path to verify
    Returns:
      a list of verification errors, or an empty list if no error is found
    Throws:
      `IOException` - if an I/O error occurs

  - ### latestMajorVersion

    static int latestMajorVersion()
    Returns the latest class major version supported by the current runtime.
    Returns:
      the latest class major version supported by the current runtime

  - ### latestMinorVersion

    static int latestMinorVersion()
    Returns the latest class minor version supported by the current runtime.
    API Note:
      This does not report the `PREVIEW_MINOR_VERSION` when the current runtime has preview feature enabled, as `class` files with a major version other than `latestMajorVersion()` and the preview minor version are not supported.
    Returns:
      the latest class minor version supported by the current runtime