Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8214230

Classes generated by SystemModulesPlugin.java are not reproducable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9, 10, 11
    • Fix Version/s: 12
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b23
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      The classes generated by src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java (jdk.internal.module.SystemModules$default.class and jdk.internal.module.SystemModules$all.class) are not reproducable between builds. This is because SystemModulesPlugin iterates over various sets (exports, requires, providers, opens, etc.) and the iteration over Set is unspecified. The iteration order do differ between builds (most likely because some of the Sets are HashSets), so the generated classes differ between builds.

      I have attached a reproducer, reproducer.zip, that can be used to show the issue. Just unzip the file and run "sh reproduce.sh" (use --verbose if you want a diff).

      I have also attached a patch that fixes this issue by sorting the collections prior to iterating over them.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ehelin Erik Helin
                Reporter:
                ehelin Erik Helin
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: