JDK-8322878 : Including sealing information Class.toGenericString()
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-01-03
  • Updated: 2024-01-16
  • Resolved: 2024-01-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b05Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
To belatedly improve support for JEP 409 (JDK-8260514), include sealing information in Class.toGenericString().

See https://mail.openjdk.org/pipermail/core-libs-dev/2024-January/117400.html

The strictfp modifier was retired as a meaningful modifier in JDK 17 (JEP 306), the same release that JEP 409 sealed classes as added as a normal feature. So in terms of updating the implementation of toGenericString() to included sealed information, since strictfp is a no-op in the same release sealed/non-sealed was added, a class file can be

    sealed XOR strictfp

Therefore, Class.toGenericString() could print the modifiers from getModifiers() and then add sealing information while retaining the blessed modifier order. In other words, the "Modifier.toString(modifiers)" code in Class.toGenericString() does not have to be "interrupted" to handle presenting sealed information in the blessed order. 
Comments
Changeset: 525063be Author: Joe Darcy <darcy@openjdk.org> Date: 2024-01-10 18:46:56 +0000 URL: https://git.openjdk.org/jdk/commit/525063be90bc67257e5d9301a4270179c03ada9d
10-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/17239 Date: 2024-01-03 06:43:22 +0000
03-01-2024

Platform classes using sealing include java.util.IllegalFormatException (JDK-8283668) java.lang.invoke.MethodHandle (JDK-8283416) java.lang.ref.Reference (JDK-8283415)
03-01-2024