# HG changeset patch # User alanb # Date 1486717587 0 # Node ID 818fdb79ae111883a957246ba8aad57810587962 # Parent b099d4afdd47c2037e90cc09fb7368b54a5b4861 8173393: Module system implementation refresh (2/2017) Reviewed-by: mchung, alanb Contributed-by: alan.bateman@oracle.com, mandy.chung@oracle.com diff -r b099d4afdd47 -r 818fdb79ae11 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java Thu Feb 09 17:21:49 2017 +0000 +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java Fri Feb 10 09:06:27 2017 +0000 @@ -1372,7 +1372,7 @@ }; final Configuration cf = parent.configuration() - .resolveRequires(finder, ModuleFinder.of(), Set.of(mn)); + .resolve(finder, ModuleFinder.of(), Set.of(mn)); final PrivilegedAction pa = () -> parent.defineModules(cf, name -> loader); final Layer layer = AccessController.doPrivileged(pa, GET_LOADER_ACC_CTXT); @@ -1798,7 +1798,7 @@ final Layer boot = Layer.boot(); final Configuration conf = boot.configuration(). - resolveRequires(mf, ModuleFinder.of(), rootMods); + resolve(mf, ModuleFinder.of(), rootMods); final String firstMod = rootMods.iterator().next(); return boot.defineModulesWithOneLoader(conf, cl).findLoader(firstMod); } diff -r b099d4afdd47 -r 818fdb79ae11 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java Thu Feb 09 17:21:49 2017 +0000 +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java Fri Feb 10 09:06:27 2017 +0000 @@ -26,9 +26,11 @@ package jdk.nashorn.internal.runtime; import java.lang.module.ModuleDescriptor; +import java.lang.module.ModuleDescriptor.Modifier; import java.lang.reflect.Module; import java.security.CodeSource; import java.util.Objects; +import java.util.Set; /** * Responsible for loading script generated classes. @@ -69,12 +71,11 @@ private Module createModule(final String moduleName) { final Module structMod = context.getStructLoader().getModule(); final ModuleDescriptor.Builder builder = - ModuleDescriptor.module(moduleName) - .requires("java.base") + ModuleDescriptor.newModule(moduleName, Set.of(Modifier.SYNTHETIC)) .requires("java.logging") .requires(NASHORN_MODULE.getName()) .requires(structMod.getName()) - .contains(SCRIPTS_PKG); + .packages(Set.of(SCRIPTS_PKG)); if (Context.javaSqlFound) { builder.requires("java.sql"); diff -r b099d4afdd47 -r 818fdb79ae11 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java Thu Feb 09 17:21:49 2017 +0000 +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java Fri Feb 10 09:06:27 2017 +0000 @@ -31,8 +31,10 @@ import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_SINGLE_FIELD_PREFIX; import java.lang.module.ModuleDescriptor; +import java.lang.module.ModuleDescriptor.Modifier; import java.lang.reflect.Module; import java.security.ProtectionDomain; +import java.util.Set; import jdk.nashorn.internal.codegen.ObjectClassGenerator; /** @@ -62,12 +64,11 @@ } private Module createModule(final String moduleName) { - final ModuleDescriptor descriptor - = ModuleDescriptor.module(moduleName) - .requires("java.base") - .requires(NASHORN_MODULE.getName()) - .contains(SCRIPTS_PKG) - .build(); + final ModuleDescriptor descriptor = + ModuleDescriptor.newModule(moduleName, Set.of(Modifier.SYNTHETIC)) + .requires(NASHORN_MODULE.getName()) + .packages(Set.of(SCRIPTS_PKG)) + .build(); final Module mod = Context.createModuleTrusted(descriptor, this); loadModuleManipulator();