Multiple versions of a non-exported dependency
Alan Bateman
Alan.Bateman at oracle.com
Thu Sep 1 07:59:00 UTC 2016
On 01/09/2016 08:28, Neil Bartlett wrote:
> :
> In contrast, Jigsaw/JPMS implements isolation using access control rather than ClassLoader visibility. All modules on the modulepath are loaded into the same ClassLoader, and a single ClassLoader can have at most one definition of each class. The implication is that two modules can conflict purely based on their private internals. If any tool attempts to construct valid module sets for use with the modulepath, it will not be sufficient for that tool to examine only the declared module metadata in module-info.class.
Tools or containers that are looking at module declarations will need to
be concerned with the non-exported packages, even if each module is
ultimately mapped to its own class loader (easy to do with Layer API, no
need to get into creating custom class loaders). Specifically, it is an
error if:
"Two or more modules in the configuration export the same package to a
module that reads both. This includes the case where a module M
containing package p reads another module that exports p to M."
Once you move beyond the command line and application module path then
there is no issue if two modules have the same non-exported package.
-Alan
More information about the jigsaw-dev
mailing list