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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.