On Fri, 18 Sep 2026 12:56:16 GMT, Dušan Bálek <[email protected]> wrote:
>> Consider the following command: >> >> jlink --add-modules java.management.rmi,jdk.httpserver --output image >> >> Running it repeatedly with identical inputs does not always produce the same >> `lib/modules` file. The only differing resource is >> `java.base/jdk/internal/module/SystemModules$all.class` (or >> `SystemModules$default.class`), generated by `SystemModulesPlugin`. The >> bytecode of `moduleReads()` differs only in the order in which the >> deduplicated sets are created and the local-variable slots in which they are >> stored. >> >> The problem occurs near the beginning of >> `SystemModulesPlugin.SystemModulesClassGenerator.generate(...)`, where >> duplicate map values are identified and assigned to local-variable slots in >> a nondeterministic order. Later in the same method, however, the map entries >> are emitted deterministically using a `TreeMap`. >> >> The proposed change uses the same `TreeMap` for value deduplication and >> local-variable-slot assignment, making the generated bytecode deterministic. >> >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Dušan Bálek has updated the pull request incrementally with one additional > commit since the last revision: > > Update test/jdk/tools/jlink/JLinkReproducible4Test.java Marked as reviewed by sgehwolf (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/32948#pullrequestreview-5249746621
