Home  >  Article  >  Java  >  What is Project Jigsaw in Java 9?

What is Project Jigsaw in Java 9?

王林
王林forward
2023-08-31 18:13:021236browse

Java 9中的项目Jigsaw是什么?

#The main goal of the Jigsaw project is to introduce the concept of modularity, create modules in Java 9 and then apply them to the JDK.

The following are some benefits of modularity (Jigsaw):

  • Strong encapsulation: Modules can only access the available parts. Public classes in a package cannot be public unless the package is explicitly exported to the module-info.java file.
  • Explicit dependencies: Modules must declare other modules they use. Modules are combined together to create a shorter runtime that can be easily scaled to relatively small computing devices.
  • Reliability: Applications become more reliable when runtime errors are eliminated. For example, we must note that our application fails at runtime due to a ClassNotFoundException due to a missing class.

The following are the various JEPs (JDK Enhancement Proposals) that are part of the Jigsaw project:

JEP 200 - Modular JDK: It uses the Java Platform Module System (JPMS) to modularize the JDK into a set of modules that are combined at build time, compile time or run time.

JEP 201 - Modular Source Code: It modularizes the JDK's source code and upgrades the build tools to compile the modules.

JEP 220 - Modular Runtime Images: It helps reorganize JRE and JDK runtime images to accommodate modules to improve security, performance and maintainability.

JEP 260 - Encapsulates most internal APIs: It allows access to most internal APIs directly, or through reflection. Accessing internal APIs is quite dangerous as they may change. To prevent the use of these APIs, they are compressed into modules and only those internal APIs available can be used.

JEP 261 - Module System: It is responsible for implementing the Java specification of the module system by changing the JVM, Java programming language, and other standard APIs.

JEP 282 - Java Linker Jlink: It allows modules and their dependencies to be packaged into a smaller runtime.

The above is the detailed content of What is Project Jigsaw in Java 9?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete