O'Reilly logo

Modular Programming in Java 9 by Koushik Kothagal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implied readability

We looked at the problem of dependency leakage in Chapter 5, Using Platform APIs. The module that you depend on might have APIs that might also require you to use another module. Here's an example:

    module A { 
      requires B; 
    } 
 
    module B { 
      requires C; 
    } 

The module A  requires module B, which in turn requires C. We know that with this, A does not read C, since module dependencies are not transitive in nature. But what if it needs to? For instance, if B has an API whose return type is in module C.

A good example can be found in the platform module itself. Let's say you write your custom module that reads java.sql. And you'd like ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required