[lworld] RFR: 8366200: Modify jimage package flags to support preview mode

David Beaumont duke at openjdk.org
Fri Aug 29 13:27:41 UTC 2025


Reuses the previously unused package flags in the /packages/xxx entries of jimage files to support preview mode.

With these flags it becomes simple to determine things like:
1. Which modules are children of /packages/xxx
  - This can differ between preview and non-preview mode.

2. Which modules/packages have any preview content
  - Useful in preview mode for faster rejection testing to avoid double-lookup on all resources.

If there are no preview resources built into the jimage file, then the difference between output is that the "isEmpty" flag (old version) has become a "hasContent" flag (but since these flags are not read by anyone right now, this should not be an issue).

Note that bumping the minor version number was done to ensure that, during testing, no undiscovered code is reading the new file with old logic (this would work since there's no structural change, but the semantics are different).

This does mean that on systems where a 'jimage' binary is installed for the JDK (e.g. /usr/bin/jimage), that tool will stop working on files generate by this code, but the version of that binary in the built JDK will work. The alternative is to just not bump the version number (if nobody is reading the flags now, it shouldn't matter what's in them).

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

Commit messages:
 - Modify jimage package flags to support preview mode

Changes: https://git.openjdk.org/valhalla/pull/1537/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1537&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366200
  Stats: 472 lines in 6 files changed: 402 ins; 22 del; 48 mod
  Patch: https://git.openjdk.org/valhalla/pull/1537.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1537/head:pull/1537

PR: https://git.openjdk.org/valhalla/pull/1537


More information about the valhalla-dev mailing list