Finally I got the 557 pages of the documentation notes for in-depth understanding of the Java module system shared by the Ali architects, and I quickly share them with you

 Preface

Java 9 puts the scattered puzzles together through the module system. The module system has become the core of the Java platform rather than an extended function. Java's module system must be compromised. It must not only maintain support for a large amount of existing code, so that it does not destroy the existing ecosystem, but also provide some meaningful help for the code that has yet to be written in the ever-changing world.

From a technical perspective, you need to understand the nature of modules and dependencies, as well as the details of syntax and componentization; from a design perspective, you need to understand the advantages and disadvantages of using modules. Like any concept or point of view, modularity cannot be added to the project casually. The adoption of modularity requires more technology and thinking. How will existing code change in a more modular world? How will modularity affect deployment and development? You need to know these questions and the answers to the questions you are exploring.

Java 9 introduces the Java Platform Module System (JPMS) into the Java language and its ecosystem. From then on, all Java developers can use modular primitives. For most people, including myself, these are new concepts, so this article will start from the beginning-from design motivation and basic concepts to advanced features to help you understand the Java module system.

table of Contents

 

The main content of this article

The structure of this article has several levels. All chapters are divided into 3 parts, but you don’t have to read them in order. I will suggest different reading ranges and reading order according to your needs.

This article has 15 chapters, divided into 3 parts.

The first part shows the shortcomings of Java that the module system should improve, and explains the basic mechanism of the module system, and how to create, build and run modular applications.

Chapter 1 points out that Java lacks support for modularity at the JAR level, discusses the negative effects of this defect and how the module system handles these defects.

 

 

Chapter 2 shows how to build and run a modular application, and introduces application examples throughout this article. This chapter shows a panoramic view of the module system, and will not explore the details-this is what we will do in the next three chapters.

 

 

Chapter 3 introduces the module declaration as the basic building block, and how the module system processes the module declaration to achieve its most important goal: to make the project more reliable and easier to maintain.

 

 

Chapter 4 shows how to compile and package a modular project using javac and jar commands.

 

 

Chapter 5 describes some new options of the java command. Starting a modular application is easy, so this chapter mainly shows the tools needed to find and solve problems.

 

 

The second part put aside the ideal project of complete modularization, demonstrated how to migrate existing projects to Java 9 and above, and gradually modularize it.

Chapter 6 explores the obstacles that people generally encounter when migrating existing code to Java 9 (no module creation has yet been involved).

 

 

Chapter 7 discusses two additional problems. Discussed separately because they are not limited to migration. After completing the migration and modularization of the project, you are likely to still encounter them.

 

 

Chapter 8 shows how to modularize large-scale projects running on Java 9. The good news is that you don’t need to do this all at once.

 

 

Chapter 9 summarizes the contents of the previous 3 chapters and helps people develop strategies for migrating and modularizing existing code.

 

 

The third part shows advanced features built on the basic concepts introduced in the first part.

Chapter 10 describes how the module system isolates API providers and users.

 

 

Chapter 11 expands the basic dependency and access mechanism introduced in Chapter 3 to provide flexibility for realizing complex scenarios in the real world.

 

 

Chapter 12 discusses how reflection is pulled off the altar, what applications, libraries, and frameworks developers need to make reflection code work, and some of the powerful features of the new extended reflection API.

 

 

Chapter 13 explains why the module system usually ignores version information, its limited support for versions, and the feasibility of running multiple versions of the same module-although this is complicated, it does work.

 

 

Chapter 14 uses the required modules to create your own runtime image, showing how to benefit from the modular JDK, and also by packaging modular applications into the image and making a single deployment unit, showing how to use modular applications Benefit from the program.

 

 

Chapter 15 uses all the fancy features of the third part to show the full picture of the application introduced in Chapter 2, and provides suggestions on how to make better use of the module system.

 

 

Friends who need this 557-page [In-depth understanding of the Java module system] document, can forward this article to follow the editor, scan the code below to get it! !

Readers of this book

The module system is a very interesting topic. Its basic principles and concepts are very simple, but its impact on the entire Java ecosystem is far-reaching. The module system is not as exciting as lambda expressions, but it can completely change the entire Java ecosystem. So far, the module system has become a part of Java like compilers, private access modifiers, and if conditional statements. Every developer needs to understand these Java concepts, and likewise, they also need to understand the module system.

Fortunately, getting started with the module system is easy. The core of the module system has only a few simple concepts, which can be understood by any developer with basic knowledge of Java. If you know the working principle of access modifiers, have a rough understanding of how to use javac, jar, and java, and know how the JVM loads classes from JAR files, then you basically meet the entry requirements.

If you are such a developer and like to accept challenges, then I encourage you to read this article. You may not be able to master it right away, but you can understand the module system in depth and further understand the Java ecosystem.

On the other hand, the integration of the module system requires two or three years of experience in Java project development. Generally speaking, the larger the project you have done, the deeper you are involved in architecture evolution, dependency choices, and solving problems caused by wrong dependencies, the more you will appreciate the benefits of the module system. At the same time, it also helps you to broadly examine the impact of the module system on existing projects and the Java ecosystem.

Guess you like

Origin blog.csdn.net/bjmashibing001/article/details/114637989