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

Roger Riggs rriggs at openjdk.org
Wed Oct 8 15:31:57 UTC 2025


On Wed, 8 Oct 2025 12:18:37 GMT, David Beaumont <duke at openjdk.org> wrote:

>> 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).

I see the semantics of the flag as `there-is-a-preview-version` of the resource.
Where-ever it appears, it means that the resource/class is in the preview branch of the hierarchy.
If the flag appears in the normal hierarchy index, it still means the same, look in the preview hierarchy.
If it appears on a directory, it means there preview resources in/below.

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

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


More information about the valhalla-dev mailing list