RFR: 8256867: Classes with empty PermittedSubclasses attribute cannot be extended [v2]

Harold Seigel hseigel at openjdk.java.net
Tue Dec 8 14:10:26 UTC 2020


> 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

Harold Seigel has updated the pull request incrementally with one additional commit since the last revision:

  8256867: Classes with empty PermittedSubclasses attribute cannot be extended

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1675/files
  - new: https://git.openjdk.java.net/jdk/pull/1675/files/89c61b95..de461457

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1675&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1675&range=00-01

  Stats: 12 lines in 2 files changed: 6 ins; 0 del; 6 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1675.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1675/head:pull/1675

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


More information about the core-libs-dev mailing list