[External] : Re: provides and requires static ... runtime error

Rob Bygrave robin.bygrave at gmail.com
Mon Apr 24 09:31:06 UTC 2023


> uses x.Plugin

No it won't.

The uses x.Plugin is in x. So the application does not have the uses clause.

Hence the problem hete that it does not 'just work'.



On Mon, 24 Apr 2023, 8:06 pm Ron Pressler, <ron.pressler at oracle.com> wrote:

>
>
> On 23 Apr 2023, at 22:44, Rob Bygrave <robin.bygrave at 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jigsaw-dev/attachments/20230424/ee087fbd/attachment.htm>


More information about the jigsaw-dev mailing list