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)
The module name generation for automatic modules is not correct and contradicts the algorithm for the namebuilding for these modules as described in ModuleFinder 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 wrong algorithm implementation:ModuleNames, 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 and semantically correct code as erroneous.