Top Description Methods
java.lang.classfile.attribute

public sealed Interface PermittedSubclassesAttribute

extends Attribute<PermittedSubclassesAttribute>, ClassElement
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundPermittedSubclassesAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundPermittedSubclassesAttribute
Annotations
@PreviewFeature
feature:CLASSFILE_API
Imports
java.lang.constant.ClassDesc, java.util.Arrays, .List, java.lang.classfile.Attribute, .ClassElement, java.lang.classfile.constantpool.ClassEntry, jdk.internal.classfile.impl.BoundAttribute, .UnboundAttribute, .Util, jdk.internal.javac.PreviewFeature

Preview

Second Preview of ClassFile API (JEP 466).

Programs can only use PermittedSubclassesAttribute 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 PermittedSubclasses attribute 4.7.31, which can appear on classes to indicate which classes may extend this class. Delivered as a java.lang.classfile.ClassElement when traversing the elements of a java.lang.classfile.ClassModel.

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.

The attribute was introduced in the Java SE Platform version 17.

Since
22

Method Summary

Modifier and TypeMethod and Description
public static PermittedSubclassesAttribute

Returns:

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

Returns a PermittedSubclasses attribute.

public static PermittedSubclassesAttribute

Returns:

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

Returns a PermittedSubclasses attribute.

public static PermittedSubclassesAttribute

Returns:

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

Returns a PermittedSubclasses attribute.

public static PermittedSubclassesAttribute

Returns:

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

Returns a PermittedSubclasses attribute.

public List<ClassEntry>

Returns:

the list of permitted subclasses
permittedSubclasses
()

Returns the list of permitted subclasses.

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

Returns:PermittedSubclassesAttribute

a PermittedSubclasses attribute

ofback to summary
public static PermittedSubclassesAttribute of(ClassEntry... permittedSubclasses)

Returns a PermittedSubclasses attribute.

Parameters
permittedSubclasses:ClassEntry[]

the permitted subclasses

Returns:PermittedSubclassesAttribute

a PermittedSubclasses attribute

ofSymbolsback to summary
public static PermittedSubclassesAttribute ofSymbols(List<ClassDesc> permittedSubclasses)

Returns a PermittedSubclasses attribute.

Parameters
permittedSubclasses:List<ClassDesc>

the permitted subclasses

Returns:PermittedSubclassesAttribute

a PermittedSubclasses attribute

ofSymbolsback to summary
public static PermittedSubclassesAttribute ofSymbols(ClassDesc... permittedSubclasses)

Returns a PermittedSubclasses attribute.

Parameters
permittedSubclasses:ClassDesc[]

the permitted subclasses

Returns:PermittedSubclassesAttribute

a PermittedSubclasses attribute

permittedSubclassesback to summary
public List<ClassEntry> permittedSubclasses()

Returns the list of permitted subclasses.

Returns:List<ClassEntry>

the list of permitted subclasses