8154578: Drop residual use of addReads from javadoc
authorksrini
Mon, 02 May 2016 15:01:54 -0700
changeset 37757 f38cc75b6fa0
parent 37756 87dff934a38a
child 37758 3ecf9b414e05
8154578: Drop residual use of addReads from javadoc Reviewed-by: alanb, jjg
langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocletInvoker.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Mon May 02 08:54:14 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Mon May 02 15:01:54 2016 -0700
@@ -242,7 +242,6 @@
             }
 
             customTagClass = tagClassLoader.loadClass(classname);
-            ensureReadable(customTagClass);
 
             Method meth = customTagClass.getMethod("register",
                                                    Map.class);
@@ -270,27 +269,6 @@
     }
 
     /**
-     * Ensures that the module of the given class is readable to this
-     * module.
-     * @param targetClass class in module to be made readable
-     */
-    private void ensureReadable(Class<?> targetClass) {
-        try {
-            Method getModuleMethod = Class.class.getMethod("getModule");
-            Object thisModule = getModuleMethod.invoke(this.getClass());
-            Object targetModule = getModuleMethod.invoke(targetClass);
-
-            Class<?> moduleClass = getModuleMethod.getReturnType();
-            Method addReadsMethod = moduleClass.getMethod("addReads", moduleClass);
-            addReadsMethod.invoke(thisModule, targetModule);
-        } catch (NoSuchMethodException e) {
-            // ignore
-        } catch (Exception e) {
-            throw new InternalError(e);
-        }
-    }
-
-    /**
      * Export javadoc internal API to the unnamed module for a classloader.
      * This is to support continued use of existing non-standard doclets that
      * use the internal toolkit API and related classes.
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocletInvoker.java	Mon May 02 08:54:14 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocletInvoker.java	Mon May 02 15:01:54 2016 -0700
@@ -102,7 +102,6 @@
         this.apiMode = apiMode;
         this.exportInternalAPI = exportInternalAPI; // for backdoor use by standard doclet for taglets
 
-        ensureReadable(docletClass);
         // this may not be soon enough if the class has already been loaded
         if (exportInternalAPI) {
             exportInternalAPI(docletClass.getClassLoader());
@@ -149,8 +148,6 @@
             messager.exit();
         }
         docletClass = dc;
-
-        ensureReadable(docletClass);
     }
 
     /*
@@ -362,27 +359,6 @@
     }
 
     /**
-     * Ensures that the module of the given class is readable to this
-     * module.
-     * @param targetClass class in module to be made readable
-     */
-    private void ensureReadable(Class<?> targetClass) {
-        try {
-            Method getModuleMethod = Class.class.getMethod("getModule");
-            Object thisModule = getModuleMethod.invoke(this.getClass());
-            Object targetModule = getModuleMethod.invoke(targetClass);
-
-            Class<?> moduleClass = getModuleMethod.getReturnType();
-            Method addReadsMethod = moduleClass.getMethod("addReads", moduleClass);
-            addReadsMethod.invoke(thisModule, targetModule);
-        } catch (NoSuchMethodException e) {
-            // ignore
-        } catch (Exception e) {
-            throw new InternalError(e);
-        }
-    }
-
-    /**
      * Export javadoc internal API to the unnamed module for a classloader.
      * This is to support continued use of existing non-standard doclets that
      * use the internal toolkit API and related classes.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Mon May 02 08:54:14 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Mon May 02 15:01:54 2016 -0700
@@ -246,7 +246,6 @@
             }
             tagClassLoader = fileManager.getClassLoader(TAGLET_PATH);
             Class<?> customTagClass = tagClassLoader.loadClass(classname);
-            ensureReadable(customTagClass);
             Object instance = customTagClass.newInstance();
             Taglet newLegacy = new UserTaglet((jdk.javadoc.doclet.taglet.Taglet)instance);
             String tname = newLegacy.getName();
@@ -262,27 +261,6 @@
     }
 
     /**
-     * Ensures that the module of the given class is readable to this
-     * module.
-     * @param targetClass class in module to be made readable
-     */
-    private void ensureReadable(Class<?> targetClass) {
-        try {
-            Method getModuleMethod = Class.class.getMethod("getModule");
-            Object thisModule = getModuleMethod.invoke(this.getClass());
-            Object targetModule = getModuleMethod.invoke(targetClass);
-
-            Class<?> moduleClass = getModuleMethod.getReturnType();
-            Method addReadsMethod = moduleClass.getMethod("addReads", moduleClass);
-            addReadsMethod.invoke(thisModule, targetModule);
-        } catch (NoSuchMethodException e) {
-            // ignore
-        } catch (Exception e) {
-            throw new InternalError(e.toString());
-        }
-    }
-
-    /**
      * Add a new <code>SimpleTaglet</code>.  If this tag already exists
      * and the header passed as an argument is null, move tag to the back of the
      * list. If this tag already exists and the header passed as an argument is
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java	Mon May 02 08:54:14 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java	Mon May 02 15:01:54 2016 -0700
@@ -331,27 +331,6 @@
     }
 
     /**
-     * Ensures that the module of the given class is readable to this
-     * module.
-     * @param targetClass class in module to be made readable
-     */
-    private void ensureReadable(Class<?> targetClass) {
-        try {
-            Method getModuleMethod = Class.class.getMethod("getModule");
-            Object thisModule = getModuleMethod.invoke(this.getClass());
-            Object targetModule = getModuleMethod.invoke(targetClass);
-
-            Class<?> moduleClass = getModuleMethod.getReturnType();
-            Method addReadsMethod = moduleClass.getMethod("addReads", moduleClass);
-            addReadsMethod.invoke(thisModule, targetModule);
-        } catch (NoSuchMethodException e) {
-            // ignore
-        } catch (Exception e) {
-            throw new InternalError(e);
-        }
-    }
-
-    /**
      * Main program - internal
      */
     private boolean parseAndExecute(List<String> argList,
@@ -550,7 +529,6 @@
             }
             try {
                 Class<?> klass = cl.loadClass(userDocletName);
-                ensureReadable(klass);
                 return klass;
             } catch (ClassNotFoundException cnfe) {
                 error("main.doclet_class_not_found", userDocletName);
@@ -601,7 +579,6 @@
         for (String tagletName : tagletNames) {
             try {
                 Class<?> klass = cl.loadClass(tagletName);
-                ensureReadable(klass);
                 if (com.sun.tools.doclets.Taglet.class.isAssignableFrom(klass)) {
                     return true;
                 }