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

Harold Seigel hseigel at openjdk.java.net
Wed Dec 9 19:11:35 UTC 2020


On Mon, 7 Dec 2020 19:51:38 GMT, Harold Seigel <hseigel 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

This pull request has now been integrated.

Changeset: d33a689b
Author:    Harold Seigel <hseigel at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/d33a689b
Stats:     167 lines in 8 files changed: 106 ins; 13 del; 48 mod

8256867: Classes with empty PermittedSubclasses attribute cannot be extended

Reviewed-by: lfoltan, mchung, jlahoda, chegar

-------------

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


More information about the hotspot-dev mailing list