<div dir="ltr"><i>> As specified in ...</i><div><br></div><div>Awesome, thanks for that.  Really nice to know that detail.</div><div><br></div><div><br></div><div><i>> just add/remove artefacts to/from the module path to add/remove service providers.</i></div><div><br></div><div>That is true and will work for some folks but also presents an issue for library authors with 000's of users who now have the ability to "stuff it up" (by not including the dependency). The ideal is to not provide users the option to "stuff it up" or at least have the default of "just works" and especially when those users number in 000's (and tend to reads documentation quickly, lightly, or not at all so we prefer to not lend on docs if we can avoid it).</div><div><br></div><div>I'll put in a reply to Josiah that outlines a couple of options available to avoid it / default to "just works".</div><div><br></div><div><br></div><div>Thanks again,</div><div>Cheers, Rob. </div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 25 Apr 2023 at 18:41, Michał Kłeczek <<a href="mailto:michal@kleczek.org">michal@kleczek.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="line-break:after-white-space">As specified in <a href="https://help.intrexx.com/apidocs/jdk17/api/java.base/java/lang/module/Configuration.html#resolveAndBind(java.lang.module.ModuleFinder,java.util.List,java.lang.module.ModuleFinder,java.util.Collection)" target="_blank">https://help.intrexx.com/apidocs/jdk17/api/java.base/java/lang/module/Configuration.html#resolveAndBind(java.lang.module.ModuleFinder,java.util.List,java.lang.module.ModuleFinder,java.util.Collection)</a><div><br></div><div>all modules reachable by a ModuleFinder are examined for uses-provides relationship and added to the set of resolved modules.</div><div><br></div><div>It gives you the optionality: just add/remove artefacts to/from the module path to add/remove service providers.</div><div><div><br><blockquote type="cite"><div>On 25 Apr 2023, at 03:39, Rob Bygrave <<a href="mailto:robin.bygrave@gmail.com" target="_blank">robin.bygrave@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><i>> only y and y.inject must be in two separate JARs.</i><div><br></div><div>Does this work without <i>any</i> module having a `requires y.inject`?  If so, how is the y.inject module get included without a<span> </span>`requires y.inject` being specified? (There is an obvious follow up question if that is the case as it likely breaks the case where only y module is used).</div><div><br></div><div><br></div><div>Cheers, Rob.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 25 Apr 2023 at 01:32, Ron Pressler <<a href="mailto:ron.pressler@oracle.com" target="_blank">ron.pressler@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">



<div style="line-break:after-white-space">
<br>
<div><br>
<blockquote type="cite">
<div>On 24 Apr 2023, at 14:23, Josiah Noel <<a href="mailto:josiahnoel@gmail.com" target="_blank">josiahnoel@gmail.com</a>> wrote:</div>
<br>
<div>
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
I’m confused. To use the implementation of the `x.Plugin` service (defined in X) that you want Y to `provides` an implementation of, some module *must* have a `uses x.Plugin`. The runtime has to know that that service is needed by the program. Maybe the application
 `uses` it, but X itself could also declare that it `uses` an implementation of a service interface that it, itself, declares. So perhaps it is X that `uses X.plugin`, but someone has to actually say they want to use the service.<br>
</blockquote>
<div> </div>
<div>I believe I'm picking up what you're putting down, but let's review it again to be sure.</div>
<div><br>
</div>
<div> </div>
<div>In artifact X we have:</div>
<div><br>
</div>
<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
<div>    exports x.spi;</div>
<div>    uses x.spi.Plugin;</div>
</blockquote>
<div><br>
</div>
</div>
<div>in artifact Y we have two modules: y and y.inject.</div>
<div><br>
</div>
<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
    exports y.stuff;<br>
</blockquote>
</div>
<div><br>
</div>
<div>And </div>
<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div>    requires x;</div>
<div>    provides x.spi.Plugin with y.inject.PluginImpl;</div>
</blockquote>
<div><br>
</div>
</div>
<div>With this in mind, we have two situations we want to support. we have an application Z that wants to use the Y artifact alone and a case where Z wants to use X and Y.</div>
<div><br>
</div>
<div>With Y alone, the z module should look like this correct?</div>
<div><br>
</div>
</div>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div>    requires y;</div>
</blockquote>
<div><br>
</div>
<div> And in the case where Z wants both X and Y (with X doing the service-loading), we do:</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
    requires x;<br>
    requires y;<br>
</blockquote>
<div><br>
</div>
<div>Am I right to understand that X will service load the y.inject plugin correctly? </div>
</div>
<input name="virtru-metadata" type="hidden" value="{"email-policy":{"disableCopyPaste":false,"disablePrint":false,"disableForwarding":false,"enableNoauth":false,"expandedWatermarking":false,"expires":false,"sms":false,"expirationNum":1,"expirationUnit":"days","isManaged":false,"persistentProtection":false},"attachments":{},"compose-id":"9","compose-window":{"secure":false}}"></div>
</div>
</blockquote>
</div>
<br>
<div>Yes.</div>
<div>This is also how it works today, only y and y.inject must be in two separate JARs.</div>
<div><br>
</div>
<div>— Ron</div>
</div>

</blockquote></div>
</div></blockquote></div><br></div></div></blockquote></div>