<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 24 Apr 2023, at 14:23, Josiah Noel <<a href="mailto:josiahnoel@gmail.com" class="">josiahnoel@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="gmail_quote" style="">
<div class=""> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid 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 class="">
</blockquote>
<div class=""> </div>
<div class="">I believe I'm picking up what you're putting down, but let's review it again to be sure.</div>
<div class=""><br class="">
</div>
<div class=""> </div>
<div class="">In artifact X we have:</div>
<div class=""><br class="">
</div>
<div class="">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br class="">
<div class="">    exports x.spi;</div>
<div class="">    uses x.spi.Plugin;</div>
</blockquote>
<div class=""><br class="">
</div>
</div>
<div class="">in artifact Y we have two modules: y and y.inject.</div>
<div class=""><br class="">
</div>
<div class="">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
    exports y.stuff;<br class="">
</blockquote>
</div>
<div class=""><br class="">
</div>
<div class="">And </div>
<div class="">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="">    requires x;</div>
<div class="">    provides x.spi.Plugin with y.inject.PluginImpl;</div>
</blockquote>
<div class=""><br class="">
</div>
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">With Y alone, the z module should look like this correct?</div>
<div class=""><br class="">
</div>
</div>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="">    requires y;</div>
</blockquote>
<div class=""><br class="">
</div>
<div class=""> And in the case where Z wants both X and Y (with X doing the service-loading), we do:</div>
<div class=""><br class="">
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
    requires x;<br class="">
    requires y;<br class="">
</blockquote>
<div class=""><br class="">
</div>
<div class="">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}}" class=""></div>
</div>
</blockquote>
</div>
<br class="">
<div class="">Yes.</div>
<div class="">This is also how it works today, only y and y.inject must be in two separate JARs.</div>
<div class=""><br class="">
</div>
<div class="">— Ron</div>
</body>
</html>