APIdia Launch Partner
Top Description Methods
java.lang.classfile.attribute

public sealed Interface NestMembersAttribute

extends Attribute<NestMembersAttribute>, ClassElement
permits BoundNestMembersAttribute, UnboundNestMembersAttribute
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundNestMembersAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundNestMembersAttribute
Imports
java.lang.classfile.Attribute, .AttributeMapper, .AttributeMapper.AttributeStability, .Attributes, .ClassElement, .ClassFile, java.lang.classfile.constantpool.ClassEntry, java.lang.constant.ClassDesc, java.util.Arrays, .List, jdk.internal.classfile.impl.BoundAttribute, .UnboundAttribute, .Util

Models the NestMembers attribute (JVMS 4.7.29), which indicates that this class is the host of a nest and the other nest members.

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 11, major version 55.

Since
24
Java Virtual Machine Specification
4.7.29 The NestMembers Attribute
See Also
Attributes#nestMembers(), NestHostAttribute, Class#getNestMembers(), Class#isNestmateOf(Class)

Method Summary

Modifier and TypeMethod and Description
public List<ClassEntry>

Returns:

the classes belonging to the nest hosted by this class
nestMembers
()

Returns the classes belonging to the nest hosted by this class.

public static NestMembersAttribute

Returns:

a NestMembers attribute
of
(List<ClassEntry>
the member classes of the nest
nestMembers
)

Returns a NestMembers attribute.

public static NestMembersAttribute

Returns:

a NestMembers attribute
of
(ClassEntry...
the member classes of the nest
nestMembers
)

Returns a NestMembers attribute.

public static NestMembersAttribute

Returns:

a NestMembers attribute
ofSymbols
(List<ClassDesc>
the member classes of the nest
nestMembers
)

Returns a NestMembers attribute.

public static NestMembersAttribute

Returns:

a NestMembers attribute
ofSymbols
(ClassDesc...
the member classes of the nest
nestMembers
)

Returns a NestMembers attribute.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

nestMembersback to summary
public List<ClassEntry> nestMembers()

Returns the classes belonging to the nest hosted by this class.

Returns:List<ClassEntry>

the classes belonging to the nest hosted by this class

See Also
Class#getNestMembers()
ofback to summary
public static NestMembersAttribute of(List<ClassEntry> nestMembers)

Returns a NestMembers attribute.

Parameters
nestMembers:List<ClassEntry>

the member classes of the nest

Returns:NestMembersAttribute

a NestMembers attribute

Exceptions
IllegalArgumentException:
if the number of member classes exceeds the limit of u2
ofback to summary
public static NestMembersAttribute of(ClassEntry... nestMembers)

Returns a NestMembers attribute.

Parameters
nestMembers:ClassEntry[]

the member classes of the nest

Returns:NestMembersAttribute

a NestMembers attribute

Exceptions
IllegalArgumentException:
if the number of member classes exceeds the limit of u2
ofSymbolsback to summary
public static NestMembersAttribute ofSymbols(List<ClassDesc> nestMembers)

Returns a NestMembers attribute.

Parameters
nestMembers:List<ClassDesc>

the member classes of the nest

Returns:NestMembersAttribute

a NestMembers attribute

Exceptions
IllegalArgumentException:
if any of nestMembers is primitive, or if the number of member classes exceeds the limit of u2
ofSymbolsback to summary
public static NestMembersAttribute ofSymbols(ClassDesc... nestMembers)

Returns a NestMembers attribute.

Parameters
nestMembers:ClassDesc[]

the member classes of the nest

Returns:NestMembersAttribute

a NestMembers attribute

Exceptions
IllegalArgumentException:
if any of nestMembers is primitive, or if the number of member classes exceeds the limit of u2