JPMS module-path and layers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

JPMS module-path and layers

Alex Sviridov

Hi all,
 
I want to understand all details of module-path and layers in java9+ and I have two questions:
*  As I understand modules on module-path are added automatically only to boot layer and not added automatically to any other layers. I mean, if any child layers are created module-path will be ignored for them. Is this correct?
*  Not all modules from module-path are added to boot layer, but only main module and dependent modules. For example, if we have  A ,  B ,  C ,  D modules on module-path and  A is main module and uses  B ,  B uses  C , then  D module won't be added to boot layer. Is this correct?
Could anyone help me with these questions?
 
--
Alex Orlov
Reply | Threaded
Open this post in threaded view
|

Re: JPMS module-path and layers

Alan Bateman
On 19/05/2020 09:00, Alex Orlov wrote:
> Hi all,
>  
> I want to understand all details of module-path and layers in java9+ and I have two questions:
> *  As I understand modules on module-path are added automatically only to boot layer and not added automatically to any other layers. I mean, if any child layers are created module-path will be ignored for them. Is this correct?
> *  Not all modules from module-path are added to boot layer, but only main module and dependent modules. For example, if we have  A ,  B ,  C ,  D modules on module-path and  A is main module and uses  B ,  B uses  C , then  D module won't be added to boot layer. Is this correct?
> Could anyone help me with these questions?
>
Have you been through the java.lang.module package description and the
APIs for Configuration.resolve? I think the main thing to understand is
that A, B, C, and D are observable when doing the module resolution and
creating the readability graph for the boot layer. D is not in the
readability graph because it's not required by any of the other modules
in the graph. Later you will use Configuration.resolve to do module
resolution for what will become the child layer. The module finders that
you specify to the resolve method will determine if D is observable or
not. Depending on the root modules that you specify to resolve, then it
might be that D is the readability graph for the child layer.

-Alan