Doubts on automatic modules and what is exported at runtime

Thomas Watson tjwats at gmail.com
Tue Nov 12 16:48:21 UTC 2019


Sorry to revisit this old topic.  I was testing this again with the latest
Java 11 on adopt open jdk and it still appears to be an issue. Did this bug
ever get opened and addressed?

Thanks
Tom

On Fri, Oct 5, 2018 at 5:04 PM Alan Bateman <Alan.Bateman at oracle.com> wrote:

> 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