Java module system: how to avoid leaking all packages of transitive modules

73 Views Asked by At

In java module system, we can have:

module hellomodule {
    exports com.name.hello;
    requires transitive greetings;
}

by doing this the packages exposed by greetings module will effectively become part of the API exposed by the hellomodue.

We may want to avoid this to a certain degree, would be nice, for example, to allow only visibility on certain classes, the ones used by hellomodule in the signature of the methods it contains perhaps.

Is there any way to do this, i.e. allow only certain classes or packages to be leaked ?

0

There are 0 best solutions below