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

Module java.base
Package java.lang.classfile.attributePREVIEW

# Interface InnerClassesAttribute

All Superinterfaces:
  `AttributePREVIEW<InnerClassesAttributePREVIEW>`, `ClassElementPREVIEW`, `ClassFileElementPREVIEW`, `WritableElementPREVIEW<InnerClassesAttributePREVIEW>`

public sealed interface InnerClassesAttribute extends AttributePREVIEW<InnerClassesAttributePREVIEW>, ClassElementPREVIEW
`InnerClassesAttribute` is a preview API of the Java platform.
Programs can only use `InnerClassesAttribute` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models the `InnerClasses` attribute 4.7.6, which can appear on classes, and records which classes referenced by this classfile are inner classes. Delivered as a `ClassElement`PREVIEW when traversing the elements of a `ClassModel`PREVIEW.

The attribute does not permit multiple instances in a given location. Subsequent occurrence of the attribute takes precedence during the attributed element build or transformation.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<InnerClassInfoPREVIEW>`
  `classes()`
  Returns the inner classes used by this class.
  `static InnerClassesAttributePREVIEW`
  `of(InnerClassInfoPREVIEW... innerClasses)`
  Returns an `InnerClasses` attribute.
  `static InnerClassesAttributePREVIEW`
  `of(List<InnerClassInfoPREVIEW> innerClasses)`
  Returns an `InnerClasses` attribute.

  ### Methods declared in interface java.lang.classfile.AttributePREVIEW

  `attributeMapper, attributeName`

  ### Methods declared in interface java.lang.classfile.WritableElementPREVIEW

  `writeTo`

- ## Method Details

  - ### classes

    List<InnerClassInfoPREVIEW> classes()
    Returns the inner classes used by this class.
    Returns:
      the inner classes used by this class

  - ### of

    static InnerClassesAttributePREVIEW of(List<InnerClassInfoPREVIEW> innerClasses)
    Returns an `InnerClasses` attribute.
    Parameters:
      `innerClasses` - descriptions of the inner classes
    Returns:
      an `InnerClasses` attribute

  - ### of

    static InnerClassesAttributePREVIEW of(InnerClassInfoPREVIEW... innerClasses)
    Returns an `InnerClasses` attribute.
    Parameters:
      `innerClasses` - descriptions of the inner classes
    Returns:
      an `InnerClasses` attribute