Why is it allowed to have several modules with the same name?
Gunnar Morling
gunnar at hibernate.org
Sun Dec 27 09:50:50 UTC 2020
Thanks for clarifying, Alan. So it is intended and well-documented, it's
still not quite clear to me though *why* that is. Wouldn#t it be more in
line with the module system's goal of reliability to reject such
error-prone configuration?
--Gunnar
Am Sa., 26. Dez. 2020 um 19:04 Uhr schrieb Alan Bateman <
Alan.Bateman at oracle.com>:
> On 26/12/2020 16:26, Jonathan Gibbons wrote:
> > If the two modules with the same name are in different positions on
> > the module path, the first one will be seen and will completely hide
> > any subsequent occurrences of modules with the same name.
> >
> > If two modules with the same name are found in the same directory on
> > the module path, such as in differently-named jar files, then that is
> > an error, because neither can be said to have precedence and hide the
> > other.
>
> Just to add to Jon's mail, there detail in in the "Module paths" section
> of JEP 261 [1] and the API docs of ModuleFinder.of(Path...) [2] which is
> the API for creating the equivalent of a module path to find modules.
>
> -Alan.
>
> [1] https://openjdk.java.net/jeps/261#Module-paths
> [2]
>
> https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/module/ModuleFinder.html#of(java.nio.file.Path..
> .)
>
More information about the jigsaw-dev
mailing list