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

Rob Bygrave robin.bygrave at gmail.com
Sun Apr 23 05:32:17 UTC 2023


> Now say some project adds the X Jar and the Y jar,

That is not the issue we have though,  but instead the issue we have is if
the application ONLY has y.jar (this fails module resolution at runtime on
startup).

If y.jar contains 2 modules but there is no x module in the module-path ...
how does the second x.y module in y.jar work / how does it change the
module resolution so that it does not produce the same error?



On Sun, 23 Apr 2023, 10:50 am Josiah Noel, <josiahnoel at gmail.com> wrote:

>
>
>> How would this solve the issue? I can't see how having a second module on
>> the same jar/artifact would work for this case.
>>
>
>  Here's how I envision it. In Jar Y, we'd have two modules.
>
>
>>  module y {
>>
>>  exports y.pkgs;
>>
>> }
>>
>
> and in the second module, we would have the SPI impl class
>
>>
>>  module y.inject {
>>   requires static x;
>>   provides x.plugin with y.inject.PluginImpl;
>>
>> }
>>
>
> Now say some project adds the X Jar and the Y jar, the modules should
> resolve and X should service load the SPI from the y.inject module.
>
>
>> Instead of a second module my gut says that what would solve this is a:
>>  'provides static'
>>
>
> I'd like this too, but I don't think it's gonna happen.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jigsaw-dev/attachments/20230423/a8428f9c/attachment-0001.htm>


More information about the jigsaw-dev mailing list