Doubts on automatic modules and what is exported at runtime
Alan Bateman
Alan.Bateman at oracle.com
Fri Oct 5 22:04:31 UTC 2018
On 05/10/2018 22:23, Thomas Watson wrote:
> :
>
> When launching Java I can use a module path that includes automatic modules
> along with normal modules that require the automatic module names.
> Everything works as expected, my normal modules are able to access the
> packages included in the automatic module as if they are exported. Now I
> try to use the ModuleLayer API to create a new layer which includes the
> same set of automatic and normal modules. If I use one of
> the defineModulesWithOneLoader method it all works just like it would when
> loading them from the module path. But if I instead use one of
> the defineModulesWithManyLoaders my normal modules that requires one of the
> automatic modules can no longer load classes from the automatic module.
You are correct. For module M1 and M2, mapped to class loaders L1 and
L2: if M1 reads M2 then L1 needs to delegate to L2 for each package that
M2 exports to M1. If M2 is an automatic module then it doesn't have any
exports to this is why the delegation isn't setup. I'll create a bug for
this.
-Alan
More information about the jigsaw-dev
mailing list