-
CSR
-
Resolution: Approved
-
P2
-
minimal
-
-
Java API, add/remove/modify command line option, Other
-
SE
Summary
Module system implementation refresh (3/2017)
Problem
This CCC tracks updating the module system introduced by JEPs 200/260/261/282 via CCC-8142968, refreshed by CCC-8154956, CCC-8169069, CCC-8173393, CCC-8173393 and several other smaller CCCs.
This refresh proposes to update JDK 9 so that it is aligned with the upcoming Public Review of JSR 376. The refresh also proposes a new command line option that works as a "kill switch" to open all standard and JDK modules for deep reflection. This allows for bad code that runs on JDK 8 to continue to run on JDK 9 without it failing with IllegalAccessException or InaccessibleObjectException.
Solution
Update JDK 9 to align with JSR 376 PR.
Update the implementation in JDK 9 to add --permit-illegal-access and warning when access succeeds due to command line options or JAR manifest attributes.
Change the value of the OS_NAME property in the $JAVA_HOME/release file on Mac OS X to align with the value of the os.name system property.
Specification
The specdiff of the API changes is attached to this CCC.
JVMS: The original CCC for the module system proposed "ModuleTarget" as a standard class file attribute. This update proposes to change it to a JDK-specific class file attribute, to be documented in JEP 261. The only change to the class file attribute is that the os_version is dropped so that the attribute is now:
ModuleTarget_attribute {
u2 attribute_name_index;
u4 attribute_length;
u2 os_name_index; // index to CONSTANT_utf8_info structure with the OS name
u2 os_arch_index; // index to CONSTANT_utf8_info structure with the OS arch
}
JAR file spec: The original CCC for the module system proposed "Add-Exports" and "Add-Opens" as attributes to be allowed in the main manifest of an application JAR file. This update proposes to change these to be JDK-specific and so documented in JEP 261.
jmod tool: This CCC drops the `--os-version` command line option to specify the OS version when creating a JMOD file.
java launcher:
1. New option --permit-illegal-access:
--permit-illegal-access
permit illegal access to members of types in named modules
by code in unnamed modules. This compatibility option will
be removed in the next release.
The effect of this command line is to open all packages of all modules in the boot layer for deep reflection. Using this command line options results in a warning at startup that the option will be removed in the next release. It also causes a warning to be printed when an access check with core reflection or setAccessible succeeds because of the option. All the details about this option will be documented in JEP 261.
2. The existing --add-exports and --add-opens options are updated so that there is a warning printed when an access check succeeds due to the command line option.
3. The existing Add-Exports and Add-Opens attributes in the main application JAR (java -jar) will also cause the runtime to print warnings when access checks succeed due to these attributes.
release file: Change the value of OS_NAME on Mac OS X from "Darwin" to "Mac OS X". The original CCC that introduced the release file is CCC-6989472. I've been unable to locate the CCC that proposed the value of OS_NAME for the Mac port.
- csr for
-
JDK-8174823 Module system implementation refresh (3/2017)
- Resolved
- relates to
-
CCC-8173393 Module system implementation refresh (2/2017)
- Closed
-
CCC-8177530 Module system implementation refresh (4/2017)
- Closed