< prev index next >

src/java.base/share/classes/java/lang/reflect/Module.java

Print this page

        

@@ -121,11 +121,11 @@
         this.loader = loader;
         this.descriptor = descriptor;
 
         // define module to VM
 
-        boolean isOpen = descriptor.isOpen();
+        boolean isOpen = descriptor.isOpen() || descriptor.isAutomatic();
         Version version = descriptor.version().orElse(null);
         String vs = Objects.toString(version, null);
         String loc = Objects.toString(uri, null);
         String[] packages = descriptor.packages().toArray(new String[0]);
         defineModule0(this, isOpen, vs, loc, packages);

@@ -1164,17 +1164,13 @@
      */
     private static void initExportsAndOpens(ModuleDescriptor descriptor,
                                             Map<String, Module> nameToModule,
                                             Module m)
     {
-        // The VM doesn't special case open or automatic modules so need to
-        // export all packages
+        // The VM special cases open and automatic modules so don't need to
+        // export their packages
         if (descriptor.isOpen() || descriptor.isAutomatic()) {
-            assert descriptor.opens().isEmpty();
-            for (String source : descriptor.packages()) {
-                addExportsToAll0(m, source);
-            }
             return;
         }
 
         Map<String, Set<Module>> openPackages = new HashMap<>();
         Map<String, Set<Module>> exportedPackages = new HashMap<>();
< prev index next >