BootstrapMethodsAttribute (Java SE 26 & JDK 26)
Description: declaration: module: java.base, package: java.lang.classfile.attribute, interface: BootstrapMethodsAttribute
Keywords: java.lang.classfile.attribute.BootstrapMethodsAttribute interface

# Interface BootstrapMethodsAttribute

All Superinterfaces:
  `Attribute<BootstrapMethodsAttribute>, ClassFileElement`

public sealed interface BootstrapMethodsAttribute extends Attribute<BootstrapMethodsAttribute>
Models the `BootstrapMethods` attribute (JVMS 4.7.23), which stores symbolic information for the execution of bootstrap methods, used by dynamically-computed call sites and constants. It is logically a part of the constant pool of a `class` file and thus not delivered in `ClassModel` traversal; its elements are accessible through `ConstantPool`.

This attribute only appears on classes, and does not permit multiple instances in a class. It has a data dependency on the constant pool.

This attribute cannot be constructed directly; its entries can be constructed through `ConstantPoolBuilder.bsmEntry(DirectMethodHandleDesc, List)`, resulting in at most one attribute instance in the built `class` file.

The attribute was introduced in the Java SE Platform version 7, major version 51.

See Java Virtual Machine Specification:
  4.7.23 The `BootstrapMethods` Attribute
Since:
  24
See Also:
  - `Attributes.bootstrapMethods()`
  - Execution of bootstrap methods

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<BootstrapMethodEntry>`
  `bootstrapMethods()`
  Returns the elements of the bootstrap method table.
  `int`
  `bootstrapMethodsSize()`
  Returns the size of the bootstrap methods table.

  ### Methods declared in interface Attribute

  `attributeMapper, attributeName`
  Modifier and Type
  Method
  Description
  `AttributeMapper<BootstrapMethodsAttribute>`
  `attributeMapper()`
  Returns the `AttributeMapper` associated with this attribute.
  `Utf8Entry`
  `attributeName()`
  Returns the name of the attribute.

- ## Method Details

  - ### bootstrapMethods

    List<BootstrapMethodEntry> bootstrapMethods()
    Returns the elements of the bootstrap method table.
    Returns:
      the elements of the bootstrap method table

  - ### bootstrapMethodsSize

    int bootstrapMethodsSize()
    Returns the size of the bootstrap methods table.
    Returns:
      the size of the bootstrap methods table