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

# Interface InnerClassInfo

public sealed interface InnerClassInfo
`InnerClassInfo` is a preview API of the Java platform.
Programs can only use `InnerClassInfo` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a single inner class in the `InnerClassesAttribute`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default Set<AccessFlag>`
  `flags()`
  Returns a set of flag enums denoting access permissions and properties of the inner class.
  `int`
  `flagsMask()`
  Returns a bit mask of flags denoting access permissions and properties of the inner class.
  `default boolean`
  `has(AccessFlag flag)`
  Returns whether a specific access flag is set.
  `ClassEntryPREVIEW`
  `innerClass()`
  Returns the class described by this inner class description.
  `Optional<Utf8EntryPREVIEW>`
  `innerName()`
  Returns the simple name of this class, or empty if this class is anonymous.
  `static InnerClassInfoPREVIEW`
  `of(ClassEntryPREVIEW innerClass, Optional<ClassEntryPREVIEW> outerClass, Optional<Utf8EntryPREVIEW> innerName, int flags)`
  Returns an inner class description.
  `static InnerClassInfoPREVIEW`
  `of(ClassDesc innerClass, Optional<ClassDesc> outerClass, Optional<String> innerName, int flags)`
  Returns an inner class description.
  `static InnerClassInfoPREVIEW`
  `of(ClassDesc innerClass, Optional<ClassDesc> outerClass, Optional<String> innerName, AccessFlag... flags)`
  Returns an inner class description.
  `Optional<ClassEntryPREVIEW>`
  `outerClass()`
  Returns the class or interface of which this class is a member, if it is a member of a class or interface.

- ## Method Details

  - ### innerClass

    ClassEntryPREVIEW innerClass()
    Returns the class described by this inner class description.
    Returns:
      the class described by this inner class description

  - ### outerClass

    Optional<ClassEntryPREVIEW> outerClass()
    Returns the class or interface of which this class is a member, if it is a member of a class or interface.
    Returns:
      the class or interface of which this class is a member, if it is a member of a class or interface

  - ### innerName

    Optional<Utf8EntryPREVIEW> innerName()
    Returns the simple name of this class, or empty if this class is anonymous.
    Returns:
      the simple name of this class, or empty if this class is anonymous

  - ### flagsMask

    int flagsMask()
    Returns a bit mask of flags denoting access permissions and properties of the inner class.
    Returns:
      a bit mask of flags denoting access permissions and properties of the inner class

  - ### flags

    default Set<AccessFlag> flags()
    Returns a set of flag enums denoting access permissions and properties of the inner class.
    Returns:
      a set of flag enums denoting access permissions and properties of the inner class

  - ### has

    default boolean has(AccessFlag flag)
    Returns whether a specific access flag is set.
    Parameters:
      `flag` - the access flag
    Returns:
      whether a specific access flag is set

  - ### of

    static InnerClassInfoPREVIEW of(ClassEntryPREVIEW innerClass, Optional<ClassEntryPREVIEW> outerClass, Optional<Utf8EntryPREVIEW> innerName, int flags)
    Returns an inner class description.
    Parameters:
      `innerClass` - the inner class being described
      `outerClass` - the class containing the inner class, if any
      `innerName` - the name of the inner class, if it is not anonymous
      `flags` - the inner class access flags
    Returns:
      an inner class description

  - ### of

    static InnerClassInfoPREVIEW of(ClassDesc innerClass, Optional<ClassDesc> outerClass, Optional<String> innerName, int flags)
    Returns an inner class description.
    Parameters:
      `innerClass` - the inner class being described
      `outerClass` - the class containing the inner class, if any
      `innerName` - the name of the inner class, if it is not anonymous
      `flags` - the inner class access flags
    Returns:
      an inner class description
    Throws:
      `IllegalArgumentException` - if `innerClass` or `outerClass` represents a primitive type

  - ### of

    static InnerClassInfoPREVIEW of(ClassDesc innerClass, Optional<ClassDesc> outerClass, Optional<String> innerName, AccessFlag... flags)
    Returns an inner class description.
    Parameters:
      `innerClass` - the inner class being described
      `outerClass` - the class containing the inner class, if any
      `innerName` - the name of the inner class, if it is not anonymous
      `flags` - the inner class access flags
    Returns:
      an inner class description
    Throws:
      `IllegalArgumentException` - if `innerClass` or `outerClass` represents a primitive type