changeset 2156:48d8835e3aaa

8177530: Module system implementation refresh (4/2017) Reviewed-by: mchung
author alanb
date Fri, 07 Apr 2017 08:08:42 +0000
parents 8c8c38891345
children e36e62d3ea53
files src/jdk.dynalink/share/classes/jdk/dynalink/beans/CallerSensitiveDynamicMethod.java src/jdk.dynalink/share/classes/jdk/dynalink/beans/CheckRestrictedPackage.java src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/Lookup.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/ModuleGraphManipulator.java test/TEST.ROOT test/src/jdk/nashorn/test/models/Reflector.java
diffstat 11 files changed, 7 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CallerSensitiveDynamicMethod.java	Thu Apr 06 17:01:05 2017 +0000
+++ b/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CallerSensitiveDynamicMethod.java	Fri Apr 07 08:08:42 2017 +0000
@@ -92,7 +92,6 @@
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.security.AccessControlContext;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
--- a/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CheckRestrictedPackage.java	Thu Apr 06 17:01:05 2017 +0000
+++ b/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CheckRestrictedPackage.java	Fri Apr 07 08:08:42 2017 +0000
@@ -84,7 +84,6 @@
 package jdk.dynalink.beans;
 
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.security.AccessControlContext;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
--- a/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/Lookup.java	Thu Apr 06 17:01:05 2017 +0000
+++ b/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/Lookup.java	Fri Apr 07 08:08:42 2017 +0000
@@ -89,7 +89,6 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Field;
-import java.lang.reflect.Module;
 import java.lang.reflect.Method;
 
 /**
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Thu Apr 06 17:01:05 2017 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Fri Apr 07 08:08:42 2017 +0000
@@ -51,9 +51,7 @@
 import java.lang.module.ModuleReader;
 import java.lang.module.ModuleReference;
 import java.lang.reflect.Field;
-import java.lang.reflect.Layer;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.nio.file.Path;
@@ -378,7 +376,7 @@
     static final boolean javaSqlFound, javaSqlRowsetFound;
 
     static {
-        final Layer boot = Layer.boot();
+        final ModuleLayer boot = ModuleLayer.boot();
         javaSqlFound = boot.findModule("java.sql").isPresent();
         javaSqlRowsetFound = boot.findModule("java.sql.rowset").isPresent();
     }
@@ -1334,7 +1332,7 @@
      * @return the new Module
      */
     static Module createModuleTrusted(final ModuleDescriptor descriptor, final ClassLoader loader) {
-        return createModuleTrusted(Layer.boot(), descriptor, loader);
+        return createModuleTrusted(ModuleLayer.boot(), descriptor, loader);
     }
 
     /**
@@ -1346,7 +1344,7 @@
      * @param loader the class loader of the module
      * @return the new Module
      */
-    static Module createModuleTrusted(final Layer parent, final ModuleDescriptor descriptor, final ClassLoader loader) {
+    static Module createModuleTrusted(final ModuleLayer parent, final ModuleDescriptor descriptor, final ClassLoader loader) {
         final String mn = descriptor.name();
 
         final ModuleReference mref = new ModuleReference(descriptor, null) {
@@ -1374,8 +1372,8 @@
         final Configuration cf = parent.configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of(mn));
 
-        final PrivilegedAction<Layer> pa = () -> parent.defineModules(cf, name -> loader);
-        final Layer layer = AccessController.doPrivileged(pa, GET_LOADER_ACC_CTXT);
+        final PrivilegedAction<ModuleLayer> pa = () -> parent.defineModules(cf, name -> loader);
+        final ModuleLayer layer = AccessController.doPrivileged(pa, GET_LOADER_ACC_CTXT);
 
         final Module m = layer.findModule(mn).get();
         assert m.getLayer() == layer;
@@ -1796,7 +1794,7 @@
                 collect(Collectors.toSet());
         }
 
-        final Layer boot = Layer.boot();
+        final ModuleLayer boot = ModuleLayer.boot();
         final Configuration conf = boot.configuration().
             resolve(mf, ModuleFinder.of(), rootMods);
         final String firstMod = rootMods.iterator().next();
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java	Thu Apr 06 17:01:05 2017 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java	Fri Apr 07 08:08:42 2017 +0000
@@ -34,7 +34,6 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.lang.reflect.Module;
 import java.security.AccessController;
 import java.security.CodeSource;
 import java.security.Permission;
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java	Thu Apr 06 17:01:05 2017 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java	Fri Apr 07 08:08:42 2017 +0000
@@ -27,7 +27,6 @@
 
 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;
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java	Thu Apr 06 17:01:05 2017 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java	Fri Apr 07 08:08:42 2017 +0000
@@ -32,7 +32,6 @@
 
 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;
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java	Thu Apr 06 17:01:05 2017 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java	Fri Apr 07 08:08:42 2017 +0000
@@ -27,7 +27,6 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 import java.security.AccessControlContext;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/ModuleGraphManipulator.java	Thu Apr 06 17:01:05 2017 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/ModuleGraphManipulator.java	Fri Apr 07 08:08:42 2017 +0000
@@ -25,7 +25,6 @@
 
 package jdk.nashorn.internal.scripts;
 
-import java.lang.reflect.Module;
 import jdk.nashorn.api.scripting.JSObject;
 
 /**
--- a/test/TEST.ROOT	Thu Apr 06 17:01:05 2017 +0000
+++ b/test/TEST.ROOT	Fri Apr 07 08:08:42 2017 +0000
@@ -8,7 +8,7 @@
 groups=TEST.groups
 
 # Minimum jtreg version
-requiredVersion=4.2 b04
+requiredVersion=4.2 b07
 
 # Use new module options
 useNewOptions=true
--- a/test/src/jdk/nashorn/test/models/Reflector.java	Thu Apr 06 17:01:05 2017 +0000
+++ b/test/src/jdk/nashorn/test/models/Reflector.java	Fri Apr 07 08:08:42 2017 +0000
@@ -29,7 +29,6 @@
 import java.lang.reflect.Executable;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.lang.reflect.Module;
 import jdk.nashorn.internal.runtime.Context;
 
 /**