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

Re-examine policy for the default set of modules when compiling or running code on the class path

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      The only behavior change is that the `java.se` aggregatror module will no longer be resolved. This module does not directly export anything and unlikely that there is code on the class path that expects this aggregator module to be resolved.
    • Interface Kind:
      Other
    • Scope:
      JDK

      Description

      Summary

      Change the default set of root modules when compiling code or running code on the class path to be all observable system modules that export an API.

      Problem

      JEP 261 defines the default set of root modules when compiling code in the unnamed module, or the java launcher is invoked and the main class of the application is loaded from the class path, as follows:

      • The java.se module is a root, if it exists. If it does not exist then every java.* module on the upgrade module path or among the system modules that exports at least one package, without qualification, is a root.

      • Every non-java.* module on the upgrade module path or among the system modules that exports at least one package, without qualification, is also a root.

      This policy is problematic when creating a run-time image that contains java.se and also contains a java.* module that is not in Java SE but exports an API, e.g. java.json. When compiling or running non-modular code, a developer needs to specify --add-modules to ensure that the non-Java SE java.* modules in the run-time image are resolved.

      A second point is that the original policy was created to ensure that the java.corba and Java EE modules (that existed in Java SE 9 and 10) were not resolved by default. These modules are proposed to be dropped from Java SE 11 so this aspect of the policy is no longer relevant.

      Solution

      Change the policy so that the default set of root modules is simply all observable modules on the upgrade module path or among the system modules that exports at least one package, without qualification.

      At compile-time, the JDK 9/10 policy for root modules will still be used when targeting 9 and 10 with --release.

      Specification

      The default set of root modules for the unnamed module is JDK-specific. There are no specifications or normative text to update. The package description for java.lang.module does have non-normative text that changes from:

      "In the JDK implementation it is the module java.se, if observable and every observable module that exports an API"

      to

      "In the JDK the default set of root modules contains every module that is observable on the upgrade module path or among the system modules, and that exports at least one package without qualification."

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alanb Alan Bateman
                Reporter:
                alanb Alan Bateman
                Reviewed By:
                Mandy Chung, Mark Reinhold
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: