-
CSR
-
Resolution: Approved
-
P2
-
high
-
-
Java API, add/remove/modify command line option
-
SE
Summary
Module system implementation refresh (4/2016)
Problem
This CCC tracks updating the module system and tools introduced by JEPs 200/260/261/282 via CCC-8142968.
In summary:
JEP 261 has been updated to define the root modules to use when compiling code in the unnamed module, and at runtime, the root modules when the main class is loaded from the class path.
The
jar
andjmod
tools are updated to define command-line options for recording the hashes of packaged modules. The new options replace a command-line option introduced by the original integration.API changes
- javax.lang.model.util.Elements defines two new methods.
- Clarification to java.lang.reflect.Module.toString
There are several other changes in this update but these other changes don't relate to supported interfaces and so do not need to be listed here.
Solution
Change javac and the VM to align with the policy for root modules described in JEP 261.
Update the jar
and jmod
tools to drop the --hash-dependencies option and replace it with the --hash-modules option.
Add two methods to javax.lang.model.util.Elements.
Specification
1. Updated policy on root modules, from JEP 261:
"When the compiler compiles code in the unnamed module, or the java launcher is invoked and the main class of the application is loaded from the class path into the unnamed module, then the default set of root modules is computed 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 and among the system modules that exports at least one package, without qualification, is a root.
Every non-java.* module on the upgrade module path and among the system modules that exports at least one package, without qualification, is also a root."
2. Drop the --hash-dependencies option from the `jar` and `jmod` tools.
For the `jmod` tool, add the a hash sub-command and two additional options:
hash - Records hashes of tied modules
--dry-run Dry run of hash mode
--hash-modules <pattern> modules to be hashed, given as a
PATTERN
For the `jar` tool, add one new option:
--hash-modules=PATTERN Compute and record the hashes of modules
matched by the given pattern and that depend upon
directly or indirectly on a modular jar being
created or a non-modular jar being updated
In both cases, PATTERN is a regular expression defined by the java.util.regex.Pattern engine, a syntax similar to Perl.
3. The attached specdiffs has the API changes.
- csr for
-
JDK-8154956 Module system implementation refresh (4/2016)
- Closed
- relates to
-
CCC-8142968 Module System implementation
- Closed