<div dir="ltr"><div class="gmail_quote" style=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><blockquote type="cite"><div dir="auto"><div dir="ltr"><div class="gmail_quote">There could be code in the module that references the implementation
class, in which case you might get NCDFE at runtime. Requires-static
might be okay during initial migration of older code that is okay
with dangling references and uses reflection guards. For
reliability, it is usually better to use services to implement
optionality.</div></div></div></blockquote></div></blockquote><div><br></div><div>If module Y required module X for normal runtime operation, would not the creator of Y know this and use requires instead of requires static? Since the dependency isn't actually optional at runtime?</div><div><br></div><div>We're talking about a case where module Y's primary purpose is not to implement SPI from X, but to provide its own packages/functionality unrelated to X. The classes in Y that use X should not be exported, and should only be loaded when X service-loads them. Hence, the Y module will use requires static to clearly inform that the classes are required at build time, but not for Y's normal operation. </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":"2","compose-window":{"secure":false}}"></div>