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

public sealed Interface PermittedSubclassesAttribute

extends Attribute<PermittedSubclassesAttribute>, ClassElement
permits BoundPermittedSubclassesAttribute, UnboundPermittedSubclassesAttribute
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundPermittedSubclassesAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundPermittedSubclassesAttribute
Annotations
@SuppressWarnings:doclint:reference
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 PermittedSubclasses attribute (JVMS 4.7.31), which indicates this class or interface is sealed, and which classes or interfaces may extend or implement this class or interface.

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 17, major version 61.

Since
24
Java Language Specification
8.1.1.2 sealed, non-sealed, and final Classes, 9.1.1.4 sealed and non-sealed Interfaces
Java Virtual Machine Specification
4.7.31 The PermittedSubclasses Attribute
See Also
Attributes#permittedSubclasses(), Class#isSealed(), Class#getPermittedSubclasses()

Method Summary

Modifier and TypeMethod and Description
public static PermittedSubclassesAttribute

Returns:

a PermittedSubclasses attribute
of
(List<ClassEntry>
the permitted subclasses or subinterfaces
permittedSubclasses
)

Returns a PermittedSubclasses attribute.

public static PermittedSubclassesAttribute

Returns:

a PermittedSubclasses attribute
of
(ClassEntry...
the permitted subclasses or subinterfaces
permittedSubclasses
)

Returns a PermittedSubclasses attribute.

public static PermittedSubclassesAttribute

Returns:

a PermittedSubclasses attribute
ofSymbols
(List<ClassDesc>
the permitted subclasses or subinterfaces
permittedSubclasses
)

Returns a PermittedSubclasses attribute.

public static PermittedSubclassesAttribute

Returns:

a PermittedSubclasses attribute
ofSymbols
(ClassDesc...
the permitted subclasses or subinterfaces
permittedSubclasses
)

Returns a PermittedSubclasses attribute.

public List<ClassEntry>

Returns:

the list of permitted subclasses or subinterfaces
permittedSubclasses
()

Returns the list of permitted subclasses or subinterfaces.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

ofback to summary
public static PermittedSubclassesAttribute of(List<ClassEntry> permittedSubclasses)

Returns a PermittedSubclasses attribute.

Parameters
permittedSubclasses:List<ClassEntry>

the permitted subclasses or subinterfaces

Returns:PermittedSubclassesAttribute

a PermittedSubclasses attribute

Exceptions
IllegalArgumentException:
if the number of permitted subclasses or subinterfaces exceeds the limit of u2
ofback to summary
public static PermittedSubclassesAttribute of(ClassEntry... permittedSubclasses)

Returns a PermittedSubclasses attribute.

Parameters
permittedSubclasses:ClassEntry[]

the permitted subclasses or subinterfaces

Returns:PermittedSubclassesAttribute

a PermittedSubclasses attribute

Exceptions
IllegalArgumentException:
if the number of permitted subclasses or subinterfaces exceeds the limit of u2
ofSymbolsback to summary
public static PermittedSubclassesAttribute ofSymbols(List<ClassDesc> permittedSubclasses)

Returns a PermittedSubclasses attribute.

Parameters
permittedSubclasses:List<ClassDesc>

the permitted subclasses or subinterfaces

Returns:PermittedSubclassesAttribute

a PermittedSubclasses attribute

Exceptions
IllegalArgumentException:
if any of permittedSubclasses is primitive, or if the number of permitted subclasses or subinterfaces exceeds the limit of u2
ofSymbolsback to summary
public static PermittedSubclassesAttribute ofSymbols(ClassDesc... permittedSubclasses)

Returns a PermittedSubclasses attribute.

Parameters
permittedSubclasses:ClassDesc[]

the permitted subclasses or subinterfaces

Returns:PermittedSubclassesAttribute

a PermittedSubclasses attribute

Exceptions
IllegalArgumentException:
if any of permittedSubclasses is primitive, or if the number of permitted subclasses or subinterfaces exceeds the limit of u2
permittedSubclassesback to summary
public List<ClassEntry> permittedSubclasses()

Returns the list of permitted subclasses or subinterfaces.

Returns:List<ClassEntry>

the list of permitted subclasses or subinterfaces

See Also
Class#getPermittedSubclasses()