Avoiding same-package conflicts

Alan Bateman Alan.Bateman at oracle.com
Wed Nov 4 08:10:41 UTC 2015


On 04/11/2015 07:45, Jeroen Frijters wrote:
> :
> In your JavaOne talk you also mentioned "[no] duplication of exported packages", but the real restriction (at least in the current builds) seems to be "no duplication of packages (in the same layer)".
>
> Can you confirm this?
>
Not quite, the requirement is that a module M cannot read two or modules 
that export the same package to M. This is one of the checks when 
creating a configuration:

http://cr.openjdk.java.net/~mr/jigsaw/spec/api/java/lang/module/Configuration.html#resolve-java.lang.module.ModuleFinder-java.lang.reflect.Layer-java.lang.module.ModuleFinder-java.util.Collection-

Instantiating a configuration as a Layer requires that you don't map two 
modules with the same package to the same class loader. More on this here:

http://cr.openjdk.java.net/~mr/jigsaw/spec/api/java/lang/reflect/Layer.html#create-java.lang.module.Configuration-java.lang.reflect.Layer.ClassLoaderFinder-

I think some of the chatter here has been specific to the boot layer 
where all modules on the application module path are mapped to the 
application class loader.

-Alan


More information about the jigsaw-dev mailing list