RFR: 8256867: Classes with empty PermittedSubclasses attribute cannot be extended

Mandy Chung mchung at openjdk.java.net
Mon Dec 7 21:59:12 UTC 2020

On Mon, 7 Dec 2020 21:30:18 GMT, Lois Foltan <lfoltan at openjdk.org> wrote:

>> Please review this fix for JDK-8256867.  This change no longer throws a ClassFormatError exception when loading a class whose PermittedSubclasses attribute is empty (contains no classes).  Instead, the class is treated as a sealed class which cannot be extended nor implemented.  This new behavior conforms to the JVM Spec.
>> This change required changing Class.permittedSubclasses() to return an empty array for classes with empty PermittedSubclasses attributes, and to return null for non-sealed classes.
>> This fix was tested with Mach5 tiers 1-2 on Linux, MacOS, and Windows, and tiers 3-5 on Linux x64.
>> Thanks, Harold
> Changes looks good Harold.
> Lois

Hi Harold,

> There is no CSR because I viewed this as a bug fix / spec conformance issue. But, I can write a CSR if you think one is needed.

This spec change needs a CSR since the return value is changed if this class is not sealed.  Please create one.


PR: https://git.openjdk.java.net/jdk/pull/1675

More information about the compiler-dev mailing list