JDK-8329721 : Store java.lang.Boolean.{TRUE,FALSE} in CDS archive
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2024-04-05
  • Updated: 2024-11-07
  • Resolved: 2024-11-07
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 24
24Resolved
Related Reports
Duplicate :  
Description
This is a preparatory step for the Leyden project.

Today, the CDS archive doesn't contain instances of java.lang.Boolean. However, this may change as we implement more Leyden optimizations. 

Going forward, in order to satisfy this requirement in the JLS

========
https://docs.oracle.com/javase/specs/jls/se21/jls21.pdf

§ 5.1.7 Boxing Conversion
If the value p being boxed is the result of evaluating a constant expression (§15.29) of type boolean, byte, char, short, int, or long, and the result is true, false, a character in the range '\u0000' to '\u007f' inclusive, or an integer in the range -128 to 127 inclusive, then let a and b be the results of any two boxing conversions of p. It is always the case that a == b.
========

If we store an instance of Boolean in the CDS archive, we must also store Boolean.TRUE and Boolean.FALSE in the archive as well, in order for the (a == b) identity tests to work as expected.
Comments
In JEP 483 (JDK-8315737), the Boolean class is archived in initialized state, so the TRUE and FALSE fields are automatically archived. Closing this RFE as a duplicate.
07-11-2024