You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Jessica-Aileen Alten (JIRA)" <ji...@apache.org> on 2019/05/08 15:28:00 UTC

[jira] [Created] (NETBEANS-2519) Wrong module name detected for automatic modules with a trailing number

Jessica-Aileen Alten created NETBEANS-2519:
----------------------------------------------

             Summary: Wrong module name detected for automatic modules with a trailing number
                 Key: NETBEANS-2519
                 URL: https://issues.apache.org/jira/browse/NETBEANS-2519
             Project: NetBeans
          Issue Type: Bug
          Components: java - Source
    Affects Versions: 11.0
         Environment: Product Version: Apache NetBeans IDE 11.0 (Build incubator-netbeans-release-404-on-20190319)
Java: 12.0.1; OpenJDK 64-Bit Server VM 12.0.1+12
Runtime: OpenJDK Runtime Environment 12.0.1+12
System: Windows 10 version 10.0 running on amd64; Cp1252; de_DE (nb)
            Reporter: Jessica-Aileen Alten


The module name generation for automatic modules is not correct and contradicts the algorithm for the namebuilding for these modules as described in [ModuleFinder|[https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/lang/module/ModuleFinder.html#of(java.nio.file.Path...)].] It truncates trailing numbers which are not part of the version string.

For Netbeans everything is OK, code completion works, no error badges in the module-info.java, import statements are clean. Unfortunately *compilation of these projects fails*!

When using module names with a corresponding trailing number in the requires part of module-info.java, Netbeans editor windows for module-info.java and source code with imports from such a modules are full of error badges, code completion does not work. But: *Compilation works fine!*

There is a convention of not using numbers in module names, but older and perhaps not well maintained and not modularized projects have these numbers in their artifacts. jdom2-2.0.6.jar is an example.

Netbeans algorithm also contradicts the behavior of the both *jdeps* and *jar* tools:

{{jar --describe-module --file=jdom2-2.0.6.jar}}

{{jdeps --generate-module-info target jdom2-2.0.6.jar dom4j-1.6.1.jar jaxen-1.2.0.jar jdom-1.1.jar xom-1.2.10.jar}}

Both resolve jdom2-2.0.6.jar to *jdom2*

With the help of the NETBEANS-602 issue I found at least one of the wrong algorithm implementation:[ModuleNames|https://github.com/apache/netbeans/blob/4f168de17f3936ae5c5b2eab694b60b984037066/java/java.source.base/src/org/netbeans/modules/java/source/ModuleNames.java], method autoName(@NonNull String moduleName), line 362, with the comment "remove trailing version" - this regex pattern is wrong here!

I am convinced that this is a critical bug because it breaks compatibility with Java tools, generates uncompilable code and marks syntactically correct code as erroneous.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists