On Fri, 17 Apr 2026 13:42:36 GMT, Severin Gehwolf <[email protected]> wrote:
>> David Beaumont has updated the pull request incrementally with two
>> additional commits since the last revision:
>>
>> - Rename ModuleReference to ModuleLink
>> - tweak comments
>
> src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JRTArchive.java line 107:
>
>> 105: .orElseThrow(() -> new IllegalArgumentException(
>> 106: "Module " + module + " not part of the JDK
>> install"));
>> 107: this.imageResources = SystemImageReader.getResourceEntries();
>
> `SystemImageReader.getResourceEntries()` uses `ImageReader.open(...,
> PreviewMode.FOR_RUNTIME)` which doesn't necessarily list **all** resources in
> a runtime image. E.g. without `--enable-preview` it lists a different set of
> resources from the runtime image than without it. The use-case here is to get
> **all** resources in a module, preview class or not.
Yes, this is a special case where I wasn't able to "hide" the entries. But here
they aren't being loaded as "resources" in the classloader sense. It's
obviously necessary that tools dealing with some providing jimage and a file
store are able to see the "raw" namespace (it need not be the jimage of the
runtime).
That method goes to "getResourceEntries()" in BasicImageReader. It DOES NOT use
preview mode:
/**
* Returns the "raw" API for accessing underlying jimage resource entries.
*
* <p>This is only meaningful for use by code dealing directly with jimage
* files, and cannot be used to reliably lookup resources used at runtime.
*
* <p>The returned {@code ResourceEntries} remains valid until the image
* reader from which it was obtained is closed.
*/
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29414#discussion_r3110989469