On 23 Apr 2023, at 22:44, Rob Bygrave 
<robin.bygr...@gmail.com<mailto:robin.bygr...@gmail.com>> wrote:

So if app module A uses Y it will have:

 requires y.

If app module A uses X and Y it will have:

requires x;
requires y;
requires y.inject;

We now need everyone using x and y together to explicitly know that y also 
provides a plugin and that they ALSO must remember to add the requires 
x.inject; (and x.inject has no exports, it only has the provides).

Have I understood correctly?

Not quite. If it uses X and Y it will have::

    requires x;
    requires y;
    uses x.Plugin;

which is exactly what you wanted, no? (You don’t even need `requires y` if Y’s 
other functionality is not used directly).

The y.inject module can be on the module path whether or not the application 
has X. It’s just not resolved unless some module `uses x.Plugin`, and to do 
that it must also `requires x` since that’s the module that defines the service 
interface `x.Plugin`.

— Ron


Reply via email to