changeset 4840:c5a3d5ae3554

Move Module and Layer to java.lang
author alanb
date Tue, 28 Mar 2017 13:28:05 +0100
parents f664546b5782
children aa338f07dc37
files src/java.compiler/share/classes/javax/tools/ToolProvider.java src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java test/com/sun/javadoc/testNestedInlineTag/testtaglets/BoldTaglet.java test/com/sun/javadoc/testNestedInlineTag/testtaglets/GreenTaglet.java test/com/sun/javadoc/testNestedInlineTag/testtaglets/UnderlineTaglet.java test/com/sun/javadoc/testTaglets/taglets/Foo.java test/jdk/javadoc/tool/CheckResourceKeys.java test/jdk/jshell/KullaTesting.java test/tools/javac/6410653/T6410653.java test/tools/javac/T6406771.java test/tools/javac/diags/CheckExamples.java test/tools/javac/diags/CheckResourceKeys.java test/tools/javac/diags/examples/NoJavaLang.java test/tools/javac/fatalErrors/NoJavaLangTest.java test/tools/javac/lib/JavacTestingAbstractProcessor.java test/tools/javac/modules/AddLimitMods.java test/tools/javac/treeannotests/TestProcessor.java test/tools/javac/warnings/VerifyLintDescriptions.java test/tools/javadoc/CheckResourceKeys.java
diffstat 22 files changed, 23 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.compiler/share/classes/javax/tools/ToolProvider.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/src/java.compiler/share/classes/javax/tools/ToolProvider.java	Tue Mar 28 13:28:05 2017 +0100
@@ -106,7 +106,7 @@
     static {
         Class<?> c = null;
         try {
-            c = Class.forName("java.lang.reflect.Module");
+            c = Class.forName("java.lang.Module");
         } catch (Throwable t) {
         }
         useLegacy = (c == null);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java	Tue Mar 28 13:28:05 2017 +0100
@@ -183,7 +183,7 @@
     }
 
     /**
-     * Wrapper class for java.lang.reflect.Module. To materialize a handle use the static factory
+     * Wrapper class for java.lang.Module. To materialize a handle use the static factory
      * methods Module#getModule(Class<?>) or Module#getUnnamedModule(ClassLoader).
      */
     public static class Module {
@@ -236,9 +236,9 @@
         }
 
         // -----------------------------------------------------------------------------------------
-        // on java.lang.reflect.Module
+        // on java.lang.Module
         private static Method addExportsMethod = null;
-        // on java.lang.reflect.Module
+        // on java.lang.Module
         private static Method addUsesMethod = null;
         // on java.lang.Class
         private static Method getModuleMethod;
@@ -248,7 +248,7 @@
         private static void init() {
             if (addExportsMethod == null) {
                 try {
-                    Class<?> moduleClass = Class.forName("java.lang.reflect.Module", false, null);
+                    Class<?> moduleClass = Class.forName("java.lang.Module", false, null);
                     addUsesMethod = moduleClass.getDeclaredMethod("addUses", new Class<?>[] { Class.class });
                     addExportsMethod = moduleClass.getDeclaredMethod("addExports",
                                                         new Class<?>[] { String.class, moduleClass });
@@ -318,7 +318,7 @@
     }
 
     /**
-     * Wrapper class for java.lang.module.Layer.
+     * Wrapper class for java.lang.ModuleLayer.
      */
     public static final class Layer {
         private final Object theRealLayer;
@@ -372,7 +372,7 @@
         private static void init() {
             if (layerClass == null) {
                 try {
-                    layerClass = Class.forName("java.lang.reflect.Layer", false, null);
+                    layerClass = Class.forName("java.lang.ModuleLayer", false, null);
                     bootMethod = layerClass.getDeclaredMethod("boot");
                     defineModulesWithOneLoaderMethod = layerClass.getDeclaredMethod("defineModulesWithOneLoader",
                                 Configuration.getConfigurationClass(),
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Tue Mar 28 13:28:05 2017 +0100
@@ -292,7 +292,7 @@
             Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
             Object thisModule = getModuleMethod.invoke(getClass());
 
-            Class<?> moduleClass = Class.forName("java.lang.reflect.Module");
+            Class<?> moduleClass = Class.forName("java.lang.Module");
             Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass);
 
             Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule");
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java	Tue Mar 28 13:28:05 2017 +0100
@@ -379,7 +379,7 @@
             Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
             Object thisModule = getModuleMethod.invoke(getClass());
 
-            Class<?> moduleClass = Class.forName("java.lang.reflect.Module");
+            Class<?> moduleClass = Class.forName("java.lang.Module");
             Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass);
 
             Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule");
--- a/test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java	Tue Mar 28 13:28:05 2017 +0100
@@ -23,8 +23,6 @@
 
 package taglets;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.*;
 
 import com.sun.javadoc.*;
--- a/test/com/sun/javadoc/testNestedInlineTag/testtaglets/BoldTaglet.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/com/sun/javadoc/testNestedInlineTag/testtaglets/BoldTaglet.java	Tue Mar 28 13:28:05 2017 +0100
@@ -23,8 +23,6 @@
 
 package testtaglets;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.*;
 
 import com.sun.javadoc.*;
--- a/test/com/sun/javadoc/testNestedInlineTag/testtaglets/GreenTaglet.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/com/sun/javadoc/testNestedInlineTag/testtaglets/GreenTaglet.java	Tue Mar 28 13:28:05 2017 +0100
@@ -23,8 +23,6 @@
 
 package testtaglets;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.*;
 
 import com.sun.javadoc.*;
--- a/test/com/sun/javadoc/testNestedInlineTag/testtaglets/UnderlineTaglet.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/com/sun/javadoc/testNestedInlineTag/testtaglets/UnderlineTaglet.java	Tue Mar 28 13:28:05 2017 +0100
@@ -23,8 +23,6 @@
 
 package testtaglets;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.*;
 
 import com.sun.javadoc.*;
--- a/test/com/sun/javadoc/testTaglets/taglets/Foo.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/com/sun/javadoc/testTaglets/taglets/Foo.java	Tue Mar 28 13:28:05 2017 +0100
@@ -23,8 +23,6 @@
 
 package taglets;
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.*;
 
 import com.sun.javadoc.*;
--- a/test/jdk/javadoc/tool/CheckResourceKeys.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/jdk/javadoc/tool/CheckResourceKeys.java	Tue Mar 28 13:28:05 2017 +0100
@@ -33,8 +33,6 @@
  */
 
 import java.io.*;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.*;
 import javax.tools.*;
 import com.sun.tools.classfile.*;
@@ -265,7 +263,7 @@
      * Get the set of keys from the javadoc resource bundles.
      */
     Set<String> getResourceKeys() {
-        Module jdk_javadoc = Layer.boot().findModule("jdk.javadoc").get();
+        Module jdk_javadoc = ModuleLayer.boot().findModule("jdk.javadoc").get();
         String[] names = {
                 "jdk.javadoc.internal.doclets.formats.html.resources.standard",
                 "jdk.javadoc.internal.doclets.toolkit.resources.doclets",
--- a/test/jdk/jshell/KullaTesting.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/jdk/jshell/KullaTesting.java	Tue Mar 28 13:28:05 2017 +0100
@@ -30,7 +30,6 @@
 import java.lang.reflect.Method;
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
 import java.nio.file.Paths;
 import java.nio.file.Path;
 import java.util.ArrayList;
@@ -211,11 +210,11 @@
 
     public ClassLoader createAndRunFromModule(String moduleName, Path modPath) {
         ModuleFinder finder = ModuleFinder.of(modPath);
-        Layer parent = Layer.boot();
+        ModuleLayer parent = ModuleLayer.boot();
         Configuration cf = parent.configuration()
                 .resolve(finder, ModuleFinder.of(), Set.of(moduleName));
         ClassLoader scl = ClassLoader.getSystemClassLoader();
-        Layer layer = parent.defineModulesWithOneLoader(cf, scl);
+        ModuleLayer layer = parent.defineModulesWithOneLoader(cf, scl);
         ClassLoader loader = layer.findLoader(moduleName);
         ClassLoader ccl = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(loader);
--- a/test/tools/javac/6410653/T6410653.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javac/6410653/T6410653.java	Tue Mar 28 13:28:05 2017 +0100
@@ -31,7 +31,6 @@
  */
 
 import java.lang.reflect.Field;
-import java.lang.reflect.Module;
 import java.io.File;
 import java.io.ByteArrayOutputStream;
 import javax.tools.*;
--- a/test/tools/javac/T6406771.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javac/T6406771.java	Tue Mar 28 13:28:05 2017 +0100
@@ -11,9 +11,9 @@
 // Editing the imports and other leading text may affect the golden text in the tests field.
 // Also beware of scripts that auto-expand tabs to spaces.
 
+
+
 import java.io.*;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.*;
 import javax.annotation.processing.*;
 import javax.lang.model.*;
--- a/test/tools/javac/diags/CheckExamples.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javac/diags/CheckExamples.java	Tue Mar 28 13:28:05 2017 +0100
@@ -39,8 +39,6 @@
  */
 
 import java.io.*;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.nio.file.*;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.*;
@@ -111,7 +109,7 @@
             }
         }
 
-        Module jdk_compiler = Layer.boot().findModule("jdk.compiler").get();
+        Module jdk_compiler = ModuleLayer.boot().findModule("jdk.compiler").get();
         ResourceBundle b =
             ResourceBundle.getBundle("com.sun.tools.javac.resources.compiler", jdk_compiler);
         Set<String> resourceKeys = new TreeSet<String>(b.keySet());
--- a/test/tools/javac/diags/CheckResourceKeys.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javac/diags/CheckResourceKeys.java	Tue Mar 28 13:28:05 2017 +0100
@@ -31,8 +31,6 @@
  */
 
 import java.io.*;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.*;
 import javax.tools.*;
 import com.sun.tools.classfile.*;
@@ -395,7 +393,7 @@
      * Get the set of keys from the javac resource bundles.
      */
     Set<String> getResourceKeys() {
-        Module jdk_compiler = Layer.boot().findModule("jdk.compiler").get();
+        Module jdk_compiler = ModuleLayer.boot().findModule("jdk.compiler").get();
         Set<String> results = new TreeSet<String>();
         for (String name : new String[]{"javac", "compiler"}) {
             ResourceBundle b =
--- a/test/tools/javac/diags/examples/NoJavaLang.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javac/diags/examples/NoJavaLang.java	Tue Mar 28 13:28:05 2017 +0100
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.misc.fatal.err.no.java.lang
-// options: -source 8 -target 8 -Xbootclasspath:
+// options: -source 8 -target 8 -Xbootclasspath: -classpath .
 // run: backdoor
 
 class NoJavaLang { }
--- a/test/tools/javac/fatalErrors/NoJavaLangTest.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javac/fatalErrors/NoJavaLangTest.java	Tue Mar 28 13:28:05 2017 +0100
@@ -74,7 +74,7 @@
 
     // test with bootclasspath, for as long as its around
     void testBootClassPath() {
-        String[] bcpOpts = { "-Xlint:-options", "-source", "8", "-bootclasspath", "." };
+        String[] bcpOpts = { "-Xlint:-options", "-source", "8", "-bootclasspath", ".", "-classpath", "." };
         test(bcpOpts, compilerErrorMessage);
     }
 
--- a/test/tools/javac/lib/JavacTestingAbstractProcessor.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javac/lib/JavacTestingAbstractProcessor.java	Tue Mar 28 13:28:05 2017 +0100
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.*;
 import javax.annotation.processing.*;
 import javax.lang.model.SourceVersion;
@@ -102,7 +100,7 @@
     protected void addExports(String moduleName, String... packageNames) {
         for (String packageName : packageNames) {
             try {
-                Layer layer = Layer.boot();
+                ModuleLayer layer = ModuleLayer.boot();
                 Optional<Module> m = layer.findModule(moduleName);
                 if (!m.isPresent())
                     throw new Error("module not found: " + moduleName);
--- a/test/tools/javac/modules/AddLimitMods.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javac/modules/AddLimitMods.java	Tue Mar 28 13:28:05 2017 +0100
@@ -418,13 +418,13 @@
                                       "    public static void main(String... args) throws Exception {\n");
 
                 for (Entry<String, String> e : MODULES_TO_CHECK_TO_SAMPLE_CLASS.entrySet()) {
-                    testClassNamed.append("        System.err.println(\"visible:" + e.getKey() + ":\" + java.lang.reflect.Layer.boot().findModule(\"" + e.getKey() + "\").isPresent());\n");
+                    testClassNamed.append("        System.err.println(\"visible:" + e.getKey() + ":\" + ModuleLayer.boot().findModule(\"" + e.getKey() + "\").isPresent());\n");
                 }
 
                 testClassNamed.append("        Class<?> cp = Class.forName(Test.class.getClassLoader().getUnnamedModule(), \"cp.CP\");\n");
                 testClassNamed.append("        cp.getDeclaredMethod(\"runMe\").invoke(null);\n");
 
-                testClassNamed.append("        Class<?> automatic = Class.forName(java.lang.reflect.Layer.boot().findModule(\"automatic\").get(), \"automatic.Automatic\");\n");
+                testClassNamed.append("        Class<?> automatic = Class.forName(ModuleLayer.boot().findModule(\"automatic\").get(), \"automatic.Automatic\");\n");
                 testClassNamed.append("        automatic.getDeclaredMethod(\"runMe\").invoke(null);\n");
 
                 testClassNamed.append("    }\n" +
--- a/test/tools/javac/treeannotests/TestProcessor.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javac/treeannotests/TestProcessor.java	Tue Mar 28 13:28:05 2017 +0100
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.io.*;
 import java.util.*;
 import javax.annotation.processing.*;
--- a/test/tools/javac/warnings/VerifyLintDescriptions.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javac/warnings/VerifyLintDescriptions.java	Tue Mar 28 13:28:05 2017 +0100
@@ -30,8 +30,6 @@
  *          jdk.compiler/com.sun.tools.javac.util
  */
 
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
@@ -42,7 +40,7 @@
 
 public class VerifyLintDescriptions {
     public static void main(String... args) {
-        Layer boot = Layer.boot();
+        ModuleLayer boot = ModuleLayer.boot();
         Module jdk_compiler = boot.findModule("jdk.compiler").get();
         ResourceBundle b = ResourceBundle.getBundle("com.sun.tools.javac.resources.javac",
                                                     Locale.US,
--- a/test/tools/javadoc/CheckResourceKeys.java	Sat Mar 25 09:03:03 2017 +0000
+++ b/test/tools/javadoc/CheckResourceKeys.java	Tue Mar 28 13:28:05 2017 +0100
@@ -32,8 +32,6 @@
  */
 
 import java.io.*;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
 import java.util.*;
 import javax.tools.*;
 import com.sun.tools.classfile.*;
@@ -229,7 +227,7 @@
      * Get the set of keys from the javadoc resource bundles.
      */
     Set<String> getResourceKeys() {
-        Module jdk_javadoc = Layer.boot().findModule("jdk.javadoc").get();
+        Module jdk_javadoc = ModuleLayer.boot().findModule("jdk.javadoc").get();
         String[] names = {
                 "com.sun.tools.doclets.formats.html.resources.standard",
                 "com.sun.tools.doclets.internal.toolkit.resources.doclets",