2018-11-28 09:59:54 UTC
this small patch ensures that two classes generated by jlink's
SystemModulePlugin (SystemModules$default and SystemModules$all) are
generated in a reproducible manner. That is, if you run jlink two times
in a row with identical input, then the generated classes from both runs
should be identical. This was almost the case already, the only issue is
that some code in SystemModulesPlugin.java are iterating over Sets, and
Set does not have a specified iteration order (the iteration order did
differ between runs).
This patch ensures that the iteration order over the sets is
well-defined by creating an ArrayList from the Set, sorting that
ArrayList and then finally iterate over the sorted ArrayList instead of
For smaller programs jlink will now produce reproducible results, the
entire lib/modules file will be reproducible . I have added a JTReg
test to verify this property (again, for smaller programs).
- tier1, tier2 and tier3 on macOS, Windows, Linux (all x86-64).
- Run newly developed JTReg test on macOS, Windows, Linux (all x86-64).
- Run newly developed JTReg test with the fix absent and verified that
the test failed.
Many thanks to Alan Bateman for helping out with the patch!