[Commented] (MCOMPILER-317) Plugin generates wrong modulepath (dependencies listed in wrong order)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Commented] (MCOMPILER-317) Plugin generates wrong modulepath (dependencies listed in wrong order)

JIRA jira@apache.org

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

Robert Scholte commented on MCOMPILER-317:
------------------------------------------

So in general the order of modules doesn't matter as long as they are unique. But this might be an interesting case. This must be fix in [plexus-java|https://github.com/codehaus-plexus/plexus-languages].
And it is indeed using a [HashMap|https://github.com/codehaus-plexus/plexus-languages/blob/master/plexus-java/src/main/java/org/codehaus/plexus/languages/java/jpms/ResolvePathsResult.java#L50] in the assumption that the overhead of a LinkedHashMap wasn't required.

> Plugin generates wrong modulepath (dependencies listed in wrong order)
> ----------------------------------------------------------------------
>
>                 Key: MCOMPILER-317
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-317
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 3.7.0
>         Environment: Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T03:58:13-04:00)
> Maven home: C:\Program Files\apache-maven-3.5.2\bin\..
> Java version: 9.0.1, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk-9.0.1
> Default locale: en_CA, platform encoding: Cp1252
> OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
>            Reporter: Gili
>
> Testcase: https://github.com/cowwoc/maven-java9-class-shadowing
> If a project contains dependencies with the same module name (which is valid according to https://stackoverflow.com/a/46573805/14731) then maven-compile-plugin invokes `javac` with a modulepath containing dependencies in an (apparently) arbitrary order. If I place the project in one directory, I get one order. If I place the project in another directory, I get another order. This is 100% reproducible across multiple runs, across different computers.
> I suspect that somewhere deep inside the code someone is using `HashMap` which is leading to undefined iteration order depending on the path being used.
> Expected behavior: dependencies should be listed in the same order as declared in pom.xml (see https://stackoverflow.com/a/793193/14731)
> Actual behavior: regardless of whether I list `ExtensionPresent` before or after `MyLibrary`, the wrong order gets passed to `javac`.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)