Uploaded image for project: 'CCC Migration Project'
  1. CCC Migration Project
  2. CCC-8169069

Module system implementation refresh (11/2016)

    XMLWordPrintable

    Details

    • Subcomponent:
    • Compatibility Risk:
      high
    • Compatibility Risk Description:
      Hide
      The original integration of the module system in March 2016 restricted setAccessible so it could no longer break into non-exported packages, but still allowed it to break into non-public elements of exported packages. The changes proposed in this CCC (JSR issue #AwkwardStrongEncapsulation) restrict setAccessible further, so it can no longer break into non-public elements of exported packages.

      This restriction is hugely significant, and will likely break many libraries and tools. To give two examples:

      1. Current versions of Spring use setAccessible to help themselves to the private constructor for jli.MethodHandles.Lookup.

      2. Current versions of Gradle use a library that hacks into the unmodifiable collection for the process environment used by java.lang.Process/ProcessBuilder so that it can change the underlying collection.

      The --add-opens command line option and the Add-Opens JAR file manifest attribute can be used to open specific packages and allow existing bad code to continue to work.

      The rest of the changes in this update should have no impact on existing applications or libraries.
      Show
      The original integration of the module system in March 2016 restricted setAccessible so it could no longer break into non-exported packages, but still allowed it to break into non-public elements of exported packages. The changes proposed in this CCC (JSR issue #AwkwardStrongEncapsulation) restrict setAccessible further, so it can no longer break into non-public elements of exported packages. This restriction is hugely significant, and will likely break many libraries and tools. To give two examples: 1. Current versions of Spring use setAccessible to help themselves to the private constructor for jli.MethodHandles.Lookup. 2. Current versions of Gradle use a library that hacks into the unmodifiable collection for the process environment used by java.lang.Process/ProcessBuilder so that it can change the underlying collection. The --add-opens command line option and the Add-Opens JAR file manifest attribute can be used to open specific packages and allow existing bad code to continue to work. The rest of the changes in this update should have no impact on existing applications or libraries.
    • Interface Kind:
      Java API, Language construct, add/remove/modify command line option, File or wire format, Other
    • Scope:
      SE

      Description

      Summary

      Module system implementation refresh (11/2016)

      Problem

      This CCC tracks updating the module system introduced by JEPs 200/260/261/282 via CCC-8142968, refreshed by CCC-8154956, and several other smaller CCCs.

      This refresh proposes to bring to JDK 9 the changes related to the following JSR 376 issues (http://openjdk.java.net/projects/jigsaw/spec/issues/)

      #CompileTimeDependences #AddExportsInManifest #ClassFileModuleName #ClassFileAccPublic #ServiceLoaderEnhancements #ResourceEncapsulation/#ClassFilesAsResources #ReflectiveAccessToNonExportedTypes #AwkwardStrongEncapsulation #ReadabilityAddedByLayerCreator #IndirectQualifiedReflectiveAccess #VersionsInModuleNames #NonHierarchicalLayers #ModuleAnnotations/#ModuleDeprecation #ReflectiveAccessByInstrumentationAgents

      Solution

      Update JDK 9 to align with where JSR 376 is at, also align with updates to JEP 261.

      Specification

      The specification changes in this CCC are a snapshot of the changes for this refresh.
      
      
      The following are attached to this CCC:
      
      lang-vm-specdiffs.html - the diffs for the "Modules in the Java Language and JVM" document that will eventually be incorporated into the JLS and JVMS
      
      api-specdiffs.zip - API specdiffs
      
      jni-specdiffs.zip - specdiffs for the update to the JNI spec
      
      jvmti-specdiffs.zip - specdiffs for the update to the JVMTI spec
      
      jdwp-specdifs.zip - specdiffs for the update to the JDWP spec
      
      jdi-specdifs.zip - specdiffs for the update to the JDI spec
      
      jar-specdiffs.zip - specdiffs for the update to the JAR File specification
      
      
      In addition to the spec/API changes, this refresh includes:
      
      1. Update to the java.corba module to add @Deprecated(since="9", forRemoval=true). The JSR for Java SE 9 is expected to propose this module be deprecated in Java SE 9 and removed in Java SE 10.
      
      2. The java launcher will support a new `--add-opens` command line option to open a package to other modules. The syntax for the command line option is the same as --add-exports and will be detailed in JEP 261. javac will accept this option and print a warning to say that it has no effect at compile-time.
      
      3. The java launcher will support new options `--version`, `--show-version`, `--help`, and `--help-extra` that are the same as `-version`, `-show-version`, `-h`, and `-X` except that they print their output to stdout rather than stderr.
      
      4. jdeps gets a new command-line option `--generate-open-module` to generate a module-info.java for an open module.
      
      5. jlink `--add-modules` now accepts token "ALL-MODULE-PATH" to mean all observable modules on the module path, this make it consistent with `java --add-modules`.

        Attachments

        1. api-specdiffs.zip
          4.56 MB
        2. jar-specdiffs.zip
          34 kB
        3. jdi-specdiffs.zip
          939 kB
        4. jdwp-specdiff.zip
          68 kB
        5. jni-specdiffs.zip
          132 kB
        6. jsr376-proposals.zip
          32 kB
        7. jvmti-specdiffs.zip
          267 kB
        8. lang-vm-specdiffs.zip
          32 kB

          Issue Links

            Activity

              People

              Assignee:
              alanb Alan Bateman
              Reporter:
              alanb Alan Bateman
              Reviewed By:
              Mandy Chung
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: