PermittedSubclasses attribute

The classes allowed to extend a sealed class or implement a sealed interface.

Appears on
class
Since
class file 61.0 (Java 17)
javac writes it
for sealed classes and interfaces
Needed by the JVM
yes: the JVM reads it to load, verify or run the class

Layout

TypeFieldWhat it holds
u2attribute_name_indexa Utf8: "PermittedSubclasses"
u4attribute_lengthbytes after this field
u2number_of_classes
u2[…]classesClass entries

What it is for

The classes allowed to extend a sealed class or implement a sealed interface. The JVM enforces it when it loads a subclass, so a class compiled separately cannot sneak into the hierarchy.

How common it is

JDK 25.0.5's java.base has 400 PermittedSubclasses attributes, in 400 of its 7,391 classes (400 on classs).

A real one, byte by byte

From Shapes$Shape.class (compiled by javac 25), on the class:

OffsetBytesFieldValue
25514 bytesPermittedSubclasses
25500 0aattribute_name_index#10
25700 00 00 08attribute_length8
26100 03number_of_classes3
26300 0bclass#11
26500 0dclass#13
26700 0fclass#15

Open in the viewer

Specification: JVMS §4.7, The PermittedSubclasses Attribute (Java SE 25).