Qualified exports

In the previous section, we looked at transitive dependencies that let us tweak the readability relationship between modules to handle some special use cases. In this section, you'll be introduced to a way you can tweak the accessibility relationships in some special cases. This can be done using a feature called qualified exports. Let's learn what they are.

You've already learned that the exports keyword lets you specify which packages in a module are allowed to be used outside the module. The exported packages form the public contract of the module, and any module that reads such a module automatically gets accessibility to those exported packages.

But there is a catch here! Ideally, you'd like to design your modules and ...

Get Modular Programming in Java 9 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.