Fix Version/s: 11
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.
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.
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:
java.semodule 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.
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
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"
"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."