< prev index next >

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

Print this page

        

*** 124,134 **** this.loader = loader; this.descriptor = descriptor; // define module to VM ! boolean isOpen = descriptor.isOpen(); 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); --- 124,134 ---- this.loader = loader; this.descriptor = descriptor; // define module to VM ! 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);
*** 1040,1052 **** // update VM first in case it fails. This is a no-op if another thread // beats us to add the package first if (syncVM) { // throws IllegalStateException if defined to another module addPackage0(this, pn); - if (descriptor.isOpen() || descriptor.isAutomatic()) { - addExportsToAll0(this, pn); - } } extraPackages.putIfAbsent(pn, Boolean.TRUE); } --- 1040,1049 ----
*** 1205,1222 **** */ private static void initExportsAndOpens(Module m, Map<String, Module> nameToSource, Map<String, Module> nameToModule, List<ModuleLayer> parents) { ! // The VM doesn't special case open or automatic modules so need to ! // export all packages ModuleDescriptor descriptor = m.getDescriptor(); 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<>(); --- 1202,1215 ---- */ private static void initExportsAndOpens(Module m, Map<String, Module> nameToSource, Map<String, Module> nameToModule, List<ModuleLayer> parents) { ! // The VM special cases open and automatic modules so don't need to ! // export their packages ModuleDescriptor descriptor = m.getDescriptor(); if (descriptor.isOpen() || descriptor.isAutomatic()) { return; } Map<String, Set<Module>> openPackages = new HashMap<>(); Map<String, Set<Module>> exportedPackages = new HashMap<>();
< prev index next >