Modular JDK in java 9



Contents of page >


1) Modular JDK in java 9 >
Use Java Platform Module System to modularize the JDK in java 9.


2) What will be there in Modular JDK in java 9 >
JDK will be divided into set of modules that can be combined at >
  • compile time,
  • build time or
  • run time into different configurations.


The modular structure make a clear distinction between standard modules (whose specifications are governed by the Java Community Process) and modules specific to JDK.
It will also distinguish modules that will be included in the Java SE Platform Specification.


3) What's the motivation behind Modular JDK in java 9?
Motivation behind Modular JDK is Jigsaw Project in java 9.
The primary goals of this Jigsaw Project -
  • To make JDK and Java SE Platform easily scalable
  • To make JDK and Java SE Platform more maintainable.
  • To make JDK and Java SE Platform Secure.
  • To improve performance of JDK and Java SE Platform.
  • To make it easier to add libraries in JDK and Java SE Platform.


4) Modular JDK implements following Design principles in java 9 >
  1. Standard modules - Names must start with the string "java."
  2. All other modules (merely part of the JDK) - Names must start with the string "jdk."


  1. If a module exports a package that contains a public or protected member (that refers to a type from some other module), then the first module must grant implied readability to the second ( via public). (This ensures that method-invocation chaining works fine).


  1. Standard module may contain both in java 9 >
    1. standard API and
    2. non-standard API packages.


  • If standard module exports a standard API package then the export may be qualified
  • if a standard module exports a non-standard API package then the export must be qualified.


  1. A standard module may depend upon one or more non-standard modules.
  2. standard module must NOT grant implied readability to any non-standard module.


  1. A non-standard module must not export any standard API packages in java 9.
  2. A non-standard module may grant implied readability to a standard module.


5) Modular JDK as a graph in java 9 >
  • Each module is a node,
  • There is directed edge from one module to another (if the first depends upon the second)
Diagram : Modular JDK as a graph
Check out full diagram on openjdk.java.net/jdk.png


Let’s understand 10 important components of graph in java 9 >
  1. Java SE modules - orange colour.
  2. Non-SE modules - blue colour.


  1. When edge from the first module to the second is solid ?
    • If one module depends upon another (it grants implied readability to that module)
  2. When edge from the first module to the second is dashed?
    • If one module depends doesn’t upon another.


  1. At top is the java.se.ee module (it gathers together all of the modules that comprise the Java SE Platform, including modules that overlap with Java EE Platform Specification)
  2. At bottom is java.base module which contains classes like >
    • java.lang.Object and
    • java.lang.String.


  1. The java.se aggregator module ( it gathers together those parts of the Java SE Platform that do not overlap with Java EE).
  2. Aggregator modules that implement the Java SE Compact Profiles >
    • java.compact1,
    • java.compact2, and
    • java.compact3.


  1. The other non-standard modules contain >
    • Debugging and serviceability tools and APIs like -
      • jdk.jdi,
      • jdk.jcmd and
      • jdk.jconsole),
    • Development tools -
      • jdk.compiler,
      • jdk.javadoc and
      • jdk.xml.bind.
    • Service providers -
      • jdk.charsets,
      • jdk.scripting.nashorn and
      • jdk.crypto.ec


  1. The java.smartcardio module is standard but not part of the Java SE Platform.


6) Dependences of modular JDK in java 9 >
Modular JDK is dependent on following >



Summary >
In this java tutorial we learned about Modular JDK in java 9.
JDK will be divided into set of modules that can be combined at compile time, build time or run time into different configurations.
The modular structure make a clear distinction between standard modules  and modules specific to JDK.

Having any doubt? or you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.

RELATED LINKS>

varHandle (variable handle) in java 9

Improved JVM compiler control and handling in java 9



Improve Locking performance in java 9

JVM logging system in Java 9 - Levels, tags, output, rotation, decoration


Labels: Java 9
eEdit
Must read for you :