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

VM: 'opens' statement cannot specify non observable package

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Not an Issue
    • Affects Version/s: 9
    • Fix Version/s: None
    • Component/s: core-libs

      Description

      Currently spec specifies:

      It is permitted for opens to specify a package which is not observable in the current module.

      However Java VM from JDK9 b152 currently fails to load module with open statement specifying package with no class files in it.

      For instance following source codes are successfully compiled:

      B/module-info.java:
      module B {
          opens pack;
      }

      B/m/Main.java:
      package m;

      public class Main {
          public static void main(String [] args) {
              System.out.println("Hello World!");
          }
      }

      B/pack/C.java:
      //Empty file

      Compilation results in following directory structure with class files:

      B/module-info.class
      B/m/Main.class

      Loading these class files by VM fails.

      The minimized test case is attached, in order to reproduce please:
      1. Unzip attached archive to some directory on Unix/Linux machine, say A;
      2. Modify A/Test60/test.sh by setting JDK_HOME to your JDK root dir;
      3. Run A/Test60/test.sh;

      This results in following output:

      Error occurred during initialization of VM
      java.lang.module.ResolutionException: Error reading module: ./out/B
              at java.lang.module.Resolver.findWithBeforeFinder(java.base@9-ea/Resolver.java:786)
              at java.lang.module.Resolver.resolveRequires(java.base@9-ea/Resolver.java:93)
              at java.lang.module.Configuration.resolveRequiresAndUses(java.base@9-ea/Configuration.java:311)
              at java.lang.module.ModuleDescriptor$1.resolveRequiresAndUses(java.base@9-ea/ModuleDescriptor.java:2522)
              at jdk.internal.module.ModuleBootstrap.boot(java.base@9-ea/ModuleBootstrap.java:278)
              at java.lang.System.initPhase2(java.base@9-ea/System.java:1927)
      Caused by: java.lang.module.InvalidModuleDescriptorException: Package pack not found by package finder
              at jdk.internal.module.ModuleInfo.invalidModuleDescriptor(java.base@9-ea/ModuleInfo.java:1078)
              at jdk.internal.module.ModuleInfo.doRead(java.base@9-ea/ModuleInfo.java:318)
              at jdk.internal.module.ModuleInfo.read(java.base@9-ea/ModuleInfo.java:125)
              at jdk.internal.module.ModulePath.readExplodedModule(java.base@9-ea/ModulePath.java:614)
              at jdk.internal.module.ModulePath.readModule(java.base@9-ea/ModulePath.java:284)
              at jdk.internal.module.ModulePath.scanDirectory(java.base@9-ea/ModulePath.java:246)
              at jdk.internal.module.ModulePath.scan(java.base@9-ea/ModulePath.java:200)
              at jdk.internal.module.ModulePath.scanNextEntry(java.base@9-ea/ModulePath.java:157)
              at jdk.internal.module.ModulePath.find(java.base@9-ea/ModulePath.java:121)
              at java.lang.module.ModuleFinder$2.lambda$find$0(java.base@9-ea/ModuleFinder.java:368)
              at java.util.stream.ReferencePipeline$3$1.accept(java.base@9-ea/ReferencePipeline.java:195)
              at java.util.AbstractList$RandomAccessSpliterator.tryAdvance(java.base@9-ea/AbstractList.java:706)
              at java.util.stream.ReferencePipeline.forEachWithCancel(java.base@9-ea/ReferencePipeline.java:127)
              at java.util.stream.AbstractPipeline.copyIntoWithCancel(java.base@9-ea/AbstractPipeline.java:502)
              at java.util.stream.AbstractPipeline.copyInto(java.base@9-ea/AbstractPipeline.java:488)
              at java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@9-ea/AbstractPipeline.java:474)
              at java.util.stream.FindOps$FindOp.evaluateSequential(java.base@9-ea/FindOps.java:152)
              at java.util.stream.AbstractPipeline.evaluate(java.base@9-ea/AbstractPipeline.java:234)
              at java.util.stream.ReferencePipeline.findFirst(java.base@9-ea/ReferencePipeline.java:476)
              at java.lang.module.ModuleFinder$2.find(java.base@9-ea/ModuleFinder.java:370)
              at java.lang.module.Resolver.findWithBeforeFinder(java.base@9-ea/Resolver.java:783)
              at java.lang.module.Resolver.resolveRequires(java.base@9-ea/Resolver.java:93)
              at java.lang.module.Configuration.resolveRequiresAndUses(java.base@9-ea/Configuration.java:311)
              at java.lang.module.ModuleDescriptor$1.resolveRequiresAndUses(java.base@9-ea/ModuleDescriptor.java:2522)
              at jdk.internal.module.ModuleBootstrap.boot(java.base@9-ea/ModuleBootstrap.java:278)
              at java.lang.System.initPhase2(java.base@9-ea/System.java:1927)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                grakov Georgiy Rakov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: