What is Project Jigsaw in Java 9?

The primary objective of the Jigsaw project is to introduce the modularity concept to create a module in Java 9 and then applying the same to JDK.

Below are some of the benefits of Modularity(Jigsaw)

  • Strong Encapsulation: The modules can access only those parts that can be available for use. Unless the package is explicitly exported into the module-info.java file, public classes in a package can't be public.
  • Clear Dependencies: A module must declare about other modules that they are used through the required clause. The modules are combined in order to create a shorter runtime that can be scaled to comparatively smaller computing devices easily.
  • Reliable: After the elimination of run-time errors, the application becomes more reliable. For instance, we must notice that our applications fail during run-time because of the missing classes that result in ClassNotFoundException.

Below are the various JEPs(JDK Enhancement Proposal) to be a part of the Jigsaw project

JEP 200modular JDK: It makes use of the Java Platform Module System(JPMS) for modularizing JDK into a set of modules that have combined at build-time, compile-time or runtime.

JEP 201 modular source code: It modularizes the source code of JDK into modules and upgrades built tools to compile modules.

JEP 220modular runtime images: It helps to restructure JRE and JDK runtime images to accommodate modules for improving security, performance, and maintainability.

JEP 260 – encapsulate most internal APIs: It permits a majority of internal APIs to be directly accessed or through reflection. It is quite risky to access the internal APIs that are bound to change. To prevent the usage of this, compressed into modules and only those internal APIs have available to use.

JEP 261 – module system: It is responsible for implementing module system Java specification by changing JVM, Java programming language, and other standard APIs.

JEP 282 - Jlink, the Java linker: It allows the packing of modules and their dependencies into smaller run-times.