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

# Interface InnerClassesAttribute

All Superinterfaces:
  `Attribute<InnerClassesAttribute>, ClassElement, ClassFileElement`

public sealed interface InnerClassesAttribute extends Attribute<InnerClassesAttribute>, ClassElement
Models the `InnerClasses` attribute (JVMS 4.7.6), which records which classes referenced by this `class` file are nested classes.

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

The attribute was introduced in the Java SE Platform version 1.1, major version 45.

See Java Virtual Machine Specification:
  4.7.6 The `InnerClasses` Attribute
Since:
  24
See Also:
  - `Attributes.innerClasses()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<InnerClassInfo>`
  `classes()`
  Returns the nested classes used by this `class` file.
  `static InnerClassesAttribute`
  `of(InnerClassInfo... innerClasses)`
  Returns an `InnerClasses` attribute.
  `static InnerClassesAttribute`
  `of(List<InnerClassInfo> innerClasses)`
  Returns an `InnerClasses` attribute.

  ### Methods declared in interface Attribute

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

- ## Method Details

  - ### classes

    List<InnerClassInfo> classes()
    Returns the nested classes used by this `class` file.
    Returns:
      the nested classes used by this `class` file

  - ### of

    static InnerClassesAttribute of(List<InnerClassInfo> innerClasses)
    Returns an `InnerClasses` attribute.
    Parameters:
      `innerClasses` - descriptions of the nested classes
    Returns:
      an `InnerClasses` attribute
    Throws:
      `IllegalArgumentException` - if the number of descriptions exceeds the limit of `u2`

  - ### of

    static InnerClassesAttribute of(InnerClassInfo... innerClasses)
    Returns an `InnerClasses` attribute.
    Parameters:
      `innerClasses` - descriptions of the nested classes
    Returns:
      an `InnerClasses` attribute
    Throws:
      `IllegalArgumentException` - if the number of descriptions exceeds the limit of `u2`