Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-2519

Wrong module name detected for automatic modules with a trailing number

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 11.0
    • None
    • java - Source

    Description

      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.

      Attachments

        1. netbeans.png
          253 kB
          Jessica-Aileen Alten

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jiai64 Jessica-Aileen Alten
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h