Skip to content

04 Advisories

Guruprasad Kulkarni edited this page Jan 11, 2018 · 5 revisions

Please get the book!!! It's really good!

This page will be removed sometime after the session.

  • In the parlance of the Java Platform Module System, module M reads module N in the following cases:

    1. M requires N.
    2. M requires a module that transitively requires N
    3. N is M or java.base.
  • For migration purposes, you can turn any JAR file into a module, simply by placing it onto a directory in the module path instead of the class path. A JAR without a module-info.class on the module path is called an automatic module. An automatic module has the following properties:

    1. The module implicitly has a requires clause for all other modules.
    2. All of its packages are exported and opened.
    3. If there is an entry with key Automatic-Module-Name in the JAR file manifest META-INF/MANIFEST.MF, the value becomes the module name.
    4. Otherwise the module name is obtained from the JAR file name, dropping any trailing version number and replacing sequences of non-alphanumeric characters with a dot.

    The first two rules imply that the packages in the automatic module act as if they were on the class path. The reason for using the module path is for the benefit of other modules, allowing them to express dependencies on this module.

  • Any class that is not on the module path is part of an unnamed module.

    1. Technically, there may be more than one unnamed module, but all of them together act as if they were a single module, which is called the unnamed module.
    2. As with automatic modules, the unnamed module can access all other modules, and all of its packages are exported and opened.
    3. However, no named module can access the unnamed module. Therefore, migration to the Java Platform Module System is necessarily a bottom-up process.
    4. The Java platform itself is modularized. Next, you modularize libraries, either by using automatic modules or by turning them into true modules.
  • Transitive and Static Requirements

    1. module javafx.controls { requires transitive javafx.base; ... }
    2. Any module that declares a requirement on javafx.controls now automatically requires javafx.base.
Clone this wiki locally