Module Layers and platform architectures
Alan Bateman
alan.bateman at oracle.com
Fri Dec 20 17:48:06 UTC 2024
On 20/12/2024 14:20, David Lloyd wrote:
> :
>
> I see, so it seems that there still would have to be a parent-child
> relationship (possibly transitive) between the layer containing the
> service consumer and the layer containing the service provider,
> correct? And the provider must be in a parent layer. I.e. using
> `jlink` doesn't magically make this constraint disappear, which is
> what I thought was being implied.
>
By "service consumer" then I assume you means the code calling
ServiceLoader.load. That code may be in a different module (and module
layer), to the service class, which in turn may be in a different
module/layer to provider class. The module with the service class may be
in the same module layer as the module with the provider class, or the
module with the provider class may be in a child layer. It can't be the
other way around as the provide class extends/implements service class.
The "service consumer" needs to be able to access the service class, and
express at either compile-time or reflectively, that it uses the
service, but otherwise can be anywhere in the picture.
jlink doesn't know anything about module layers at this time but there
is a of interesting directions that could be explored.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jigsaw-dev/attachments/20241220/63b9dc69/attachment-0001.htm>
More information about the jigsaw-dev
mailing list