Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8210151

InvalidModuleDescriptorException thrown when exported package in patch rather than module directory

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      java throws a java.lang.module.InvalidModuleDescriptorException when a module-info.class in a directory in the module path exports a package that isn't under the same directory.

      That is sensible behavior in many circumstances, but, in my case, I have the package under another directory which is patched into the module in question using --patch-module.

      Given that I've patched into the module the directory that contains the exported package, I think that java should not throw the exception.

      Example:
      Module m is defined in classes/m/module-info.class, and it exports package p. module-info.class is the only child of directory classes/m.

      Directory classes/patch contains p/Main.class.

      Simplified command line:

      java --module-path classes/m --patch-module m=classes/patch --module m/p.Main

      The above will throw java.lang.module.InvalidModuleDescriptorException that says that "Package p not found in module". It would be nice if java realized p was patched into m via classes/patch, and didn't throw the error.

      This would simplify supporting modules in Gradle Test tasks.


            alanb Alan Bateman
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: