[External] : Re: provides and requires static ... runtime error
Josiah Noel
josiahnoel at gmail.com
Thu Apr 20 15:03:20 UTC 2023
>
> 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.
>
>
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?
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jigsaw-dev/attachments/20230420/03d34e03/attachment-0001.htm>
More information about the jigsaw-dev
mailing list