Category: Qualified Opens Directive
-
Categories of Modules – Java Module System
•
19.11 Categories of Modules The Java Module System is designed to allow both non-modular and modular code to work together. Types are usually bundled in JAR files. Regardless of whether it a plain JAR or a modular JAR, how its content is handled by the module system depends on the…
-
Explicit Modules – Java Module System
•
Explicit Modules As the name implies, an explicit module is described by its module descriptor that explicitly specifies its name and the modules it reads (i.e., its dependencies), including any packages it exports or opens, or any services it provides or uses. A modular JAR is treated as an explicit…
-
Bottom-Up Strategy for Code Migration – Java Module System
•
Bottom-Up Strategy for Code Migration If all direct dependencies of a plain JAR are known to be modules, the plain JAR can be directly converted to an explicit module by declaring their dependencies and exports in a module declaration. This idea is embodied in the following algorithm, based on the…
-
Exploring Modules – Java Module System
•
19.13 Exploring Modules This section provides an introduction to using the JDK tools to discover, explore, and analyze modular applications. Given the JARs main.jar, control.jar, view.jar, and model.jar for the adviceApp application in the mlib directory in Figure 19.14(c), p. 1188, we will use JDK tools to explore these archives…
-
Module Graph – Java Module System
•
Module Graph The structure of an application is reflected by its module graph constructed from dependencies between its modules. An important aspect of the module system is to perform module resolution at compile time and runtime to ensure that the application has a reliable configuration. This process resolves all dependencies,…
-
Creating the Application Directory Structure – Java Module System
•
Creating the Application Directory Structure Typically, the code for a modular application is organized in a directory structure, similar to the one shown in Figure 19.9. The modules are created in the src directory and compiled into the mods directory. The compiled modules are bundled into modular JARs and placed…
-
Parsing Values Using Patterns – Localization
•
Parsing Values Using Patterns An instance of the MessageFormat class can be used both for formatting and for parsing of values. The class provides the parse() methods for parsing text. We will primarily use the one-argument method shown below to demonstrate parsing with the MessageFormat class. Click here to view…
-
Multi-Module Compilation – Java Module System
•
Multi-Module Compilation It is tedious compiling modules individually. It is more convenient to use the following command: Click here to view code image >javac –module-source-path src -d mods –module main The –module-source-path option (no short form), as the name suggests, indicates the src directory where the exploded modules with the…
-
Creating JAR Files – Java Module System
•
19.7 Creating JAR Files A JAR (Java Archive) file is a convenient way of bundling and deploying Java executable code and any other resources that are required (e.g., image or audio files). A JAR file is created by using the jar tool. The jar command has many options, akin to…
-
Services – Java Module System
•
19.9 Services Programming to interfaces is a powerful design paradigm that advocates writing code using interfaces and abstract classes—that is, using abstract types and not concrete types. This allows new implementations of abstract types to be used by the code if and when necessary. This strategy results in the code…