RFR: [lworld] Switch JLink to not use ImageReader API [v3]

David Beaumont duke at openjdk.org
Wed Nov 5 02:08:47 UTC 2025


On Wed, 5 Nov 2025 02:05:46 GMT, David Beaumont <duke at openjdk.org> wrote:

>> Creates a new, narrowed API explicitly for use by jlink, which view the resource entries in a jimage file without the re-mapping of names and invention of synthetic entries inherent in ImageReader.
>> 
>> Another good reason to express this new API as something other than ImageReader is that, to fix issues such as [JDK-8357249](https://bugs.openjdk.org/browse/JDK-8357249), we don't want to have the (System)ImageReader class used directly in jlink code. It's just the wrong abstraction and will make it harder to refactor jlink to use a non-singleton API with a controlled lifetime later. 
>> 
>> I've not added unit tests for the new API (yet), but the fact the PackagedModulesVsRuntimeImageLinkTest passes with preview content in the jimage file means that it's working as expected.
>
> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Tighted access to new API and undo new path() method.

src/java.base/share/classes/jdk/internal/jimage/SystemImageReader.java line 76:

> 74:     }
> 75: 
> 76:     /**

I moved the public method to SystemImageReader, since that's the only use-case we have for it at the moment.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1721#discussion_r2492576433


More information about the valhalla-dev mailing list