RFR: 8368333: [lworld] Add preview mode to ImageReader and JRT file-system [v3]

David Beaumont duke at openjdk.org
Wed Oct 8 12:25:38 UTC 2025


On Wed, 24 Sep 2025 18:20:58 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Manually deleting ImageReaderFactory (it returned somehow)
>
> src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java line 42:
> 
>> 40:  * <ul>
>> 41:  *     <li>src/java.base/share/native/libjimage/imageFile.hpp
>> 42:  * </ul>
> 
> Are there any java source files that have to be updated on a version change?

This is it I think. Everything else reading/writing the jimage file just uses this constant as far as I can tell. But it's possible I'm wrong. Certainly none of the code I'm changing in these PRs needed more than this altered for the version bump, but I can't rule out things like command line tools I've not found yet (but I have no evidence). The jimage tool uses these classes, so gets the change from here.

> src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java line 72:
> 
>> 70:      * <p>This flag is mutually exclusive with {@link #FLAGS_HAS_PREVIEW_VERSION}.
>> 71:      */
>> 72:     public static final int FLAGS_IS_PREVIEW_VERSION = 0x2;
> 
> Seems to be redundant with HAS_PREVIEW_VERSION when seen in a preview location.

Ah, but HAS_PREVIEW_VERSION is never set on a preview location. It's only for non-preview locations to indicate that a (different) preview version exists.

HAS_PREVIEW_VERSION can also be set for /packages/xxx directory entries (where it means "some of the entries are modules in which preview versions of resources exist" rather than "there's a META-INF/preview version of this entry"). IS_PREVIEW_VERSION is kind of meaningless for the /packages/xxx directories though, and is never set on them.

I'm not sure I'm a fan of trying to merge the semantics of these into some sort of "HAS_OR_IS_PREVIEW_VERSION" flag though. We're not short on flag space (and are extremely unlikely to ever be).

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1619#discussion_r2413662039
PR Review Comment: https://git.openjdk.org/valhalla/pull/1619#discussion_r2413668235


More information about the valhalla-dev mailing list