JDK-8352528 : Move CDS WhiteBox APIs to jdk.internal.test.cds.WhiteBox
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • Submitted: 2025-03-20
  • Updated: 2025-03-24
Related Reports
Blocks :  
Relates :  
Relates :  
Description
https://github.com/openjdk/jdk/blob/2bc4f64c56ebc844d494a4ce8ba72a25643d4075/test/lib/jdk/test/whitebox/WhiteBox.java#L729-L743

CDS regression tests make WhiteBox extensively. There are 175 files that references "WhiteBox" under test/hotspot/jtreg/runtime/cds/. 

However, WhiteBox is cumbersome to use. Many CDS tests end up not using WhiteBox, but use more brute-force method. For example: instead of calling WhiteBox::isSharedClass, many tests run with -Xlog:class+load and grep for "shared objects".

==================
Proposal:

Move the APIs to jdk.internal.test.cds.WhiteBox so these APIs are available inside java.base. This avoid the need for building WhiteBox.jar and appending it to -Xbootclasspath.

CDS tests cases can use a single line in their test description to indicate the need for this class:

   @module java.base/jdk.internal.test.cds.WhiteBox

For Java processes launched by CDS (using jdk.test.lib.cds.CDSTestUtils, etc), when necessary we can add "--add-exports java.base/jdk.internal.test.cds=ALL-UNNAMED" to their command-line.

Note: this RFE replaces JDK-8352107