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

inconsistent check of module-related options against target version

    Details

    • Subcomponent:
    • Resolved In Build:
      b154
    • Verification:
      Not verified

      Backports

        Description

        javac Arguments checking allows some module related options to be specified for use with older releases, but not others. This is inconsistent and should be fixed.

                checkOptionAllowed(t.compareTo(Target.JDK1_8) <= 0,
                        option -> error("err.option.not.allowed.with.target", option.getPrimaryName(), t.name),
                        Option.BOOT_CLASS_PATH,
                        Option.XBOOTCLASSPATH_PREPEND, Option.XBOOTCLASSPATH, Option.XBOOTCLASSPATH_APPEND,
                        Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS,
                        Option.EXTDIRS, Option.DJAVA_EXT_DIRS);

                checkOptionAllowed(t.compareTo(Target.JDK1_9) >= 0,
                        option -> error("err.option.not.allowed.with.target", option.getPrimaryName(), t.name),
                        Option.MODULE_SOURCE_PATH, Option.UPGRADE_MODULE_PATH,
                        Option.SYSTEM, Option.MODULE_PATH, Option.ADD_MODULES, Option.LIMIT_MODULES,
                        Option.PATCH_MODULE);

        The first block of checks are OK; these options should not be allowed with -target 9; the second block lists --add-modules but not --add-exports, --add-opens, --add-reads. Arguably, all should be allowed if using the platform modules, i.e. using older -release, or using older -target without -bootclasspath.

          Activity

          Hide
          jjg Jonathan Gibbons added a comment -
          Relates to proposed jtreg change to use -add-modules for all modules listed with @modules
          Show
          jjg Jonathan Gibbons added a comment - Relates to proposed jtreg change to use -add-modules for all modules listed with @modules
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/langtools/rev/a3c8bca17094
          User: vromero
          Date: 2017-01-20 16:45:11 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/langtools/rev/a3c8bca17094 User: vromero Date: 2017-01-20 16:45:11 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/a3c8bca17094
          User: lana
          Date: 2017-01-25 21:47:02 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/a3c8bca17094 User: lana Date: 2017-01-25 21:47:02 +0000

            People

            • Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              jjg Jonathan Gibbons
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: