[ 
https://issues.apache.org/jira/browse/MJLINK-27?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16634583#comment-16634583
 ] 

Gili commented on MJLINK-27:
----------------------------

Karl,

[http://openjdk.java.net/jeps/261] defines an element as a JAR file or a 
directory.
{quote}When searching a module path for a module of a particular name, the 
module system takes the first definition of a module of that name
{quote}
I want to emphasize this sentence. They wouldn't talk about using the first 
match if having multiple modules with the same name always failed.
{quote}if an element of a module path contains definitions of multiple modules 
with the same name then resolution fails and the compiler, linker, or virtual 
machine will report an error and exit.
{quote}
Let's break this down piece by piece.
 * A JAR file cannot contain multiple files with the same path, hence it cannot 
contain multiple modules with the same name.
 * The only element that may contain multiple modules with the same name is a 
directory.
 * Hence, if a directory contains multiple modules with the same name then 
resolution will fail.
 * If multiple JAR files contain a module with the same name, then the first 
match on the module path is used.

> Code incorrectly assumes that two modules won't have the same name
> ------------------------------------------------------------------
>
>                 Key: MJLINK-27
>                 URL: https://issues.apache.org/jira/browse/MJLINK-27
>             Project: Maven JLink Plugin
>          Issue Type: Bug
>    Affects Versions: 3.0.0-alpha-2
>            Reporter: Gili
>            Priority: Major
>
> Karl Heinz Marbaise closed MJLINK-7 referencing [a Stackoverflow 
> post|https://stackoverflow.com/questions/46573572/java-9-possible-to-have-2-modules-with-same-name-on-module-path/46574200#46574200]
>  to prove that module names must be unique. In fact, this Stackoverflow post 
> says the exact opposite. The bottom half of the post states that modules in 
> separate directories **are** allowed to have the same name. The bottom of the 
> post concludes:
> {quote}That makes it possible to have the same module in different 
> directories.
> {quote}
> It doesn't have to be the same module per-se. It is possible for two 
> different implementations with the same module name to reside on the module 
> path, so long as the modules reside in different directory. This is useful 
> for "class shadowing". In my particular case, I ship a no-op implementation 
> of a module by default but users can insert a working implementation in front 
> of the module path to enable the feature.
> Please reopen this issue or continue its work here.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to