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

Wrong module name detected with multi-release JAR

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 9.0
    • Fix Version/s: 10.0
    • Component/s: java - Source
    • Environment:

      JDK 9.0.4 and JDK 10 on Linux
      NetBeans jenkins build

      Description

      I was doing a quick experiment with lwjgl (Lightweight Java Game Library) and Java modules an a recent jenkins build of netbeans 9.0.

      The screenshot shows the error condition.

      The reproducer is to:

      • Create a new Java Modular Project with a JDK9 or JDK10 platform.
      • Create a new module
      • In the module add the lwjgl-3.1.6.jar downloaded from [http://search.maven.org/remotecontent?filepath=org/lwjgl/lwjgl/3.1.6/lwjgl-3.1.6.jar|maven].

      At this point netbeans shows the project as valid but the project fails to build. Updating the modules-info.java from 'requires lwjgl;' causes netbeans to show an invalid project but the project now builds correctly.

      With a maven project the projects is also shown as invalid.


      Digging through the code it looks like the getModuleName(URL,boolean) method in java.source.base/src/org/netbeans/modules/java/source/ModuleNames.java needs to be updated to support the Multi-release JAR files section from the [https://docs.oracle.com/javase/9/docs/specs/jar/jar.html#multi-release-jar-files|JAR File Spec].

      Probable change in Binary logic is to first look for Multi-Release attribute in the MANIFEST.MF. If true, starting with current source version (not currently supplied to the method), work backwards in source versions looking for a module-info.class in the versions directories, use it's module name if found. Otherwise (or false) use the current logic, root module-info module name, Automatic-Module-Name, or compute an automatic module name.

        Attachments

        1. multirel.png
          52 kB
          Robert Fitzsimons

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                robfitz Robert Fitzsimons
              • Votes:
                0 Vote for this issue
                Watchers:
                2 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 - 1.5h
                  1.5h