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

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


On Wed, 24 Sep 2025 18:26:07 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/ImageLocation.java line 56:
> 
>> 54:     /**
>> 55:      * Indicates that a non-preview location is associated with preview
>> 56:      * resources.
> 
> This comment would read better saying that preview resources exist related to this location.
> More like FLAGS_HAS_PREVIEW_VERSION.

Ahh, but it's deliberately not worded like that because this flag can be set for "/packages/xxx" entries, for which "preview resources exist related to this location" is not a meaningful statement.

This is where you could add another flag (e.g. "FLAGS_PACKAGE_HAS_PREVIEW_ENTRIES"), but it felt better to use the same flag for this, since where it's calculated becomes a neat case of just propagating the flag (next PR):


            // Calculate the package's ImageLocation flags.
            boolean hasPreviewVersion =
                    moduleReferences.stream().anyMatch(ModuleReference::hasPreviewVersion);
            boolean isPreviewOnly =
                    moduleReferences.stream().allMatch(ModuleReference::isPreviewOnly);
            return (hasPreviewVersion ? ImageLocation.FLAGS_HAS_PREVIEW_VERSION : 0)
                    | (isPreviewOnly ? ImageLocation.FLAGS_IS_PREVIEW_ONLY : 0);


And the flag/method names in this code just match across this logic.

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

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


More information about the valhalla-dev mailing list