src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
changeset 54821 85ccac8a8c13
parent 54060 53a95878619f
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java	Fri Apr 05 11:52:32 2019 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java	Mon May 13 16:43:47 2019 +0200
@@ -31,6 +31,7 @@
 import java.util.List;
 
 import javax.lang.model.element.Element;
+import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
 import javax.tools.FileObject;
@@ -121,6 +122,12 @@
         if (docEnv == null || outputdir == null) {
             return;
         }
+        for (ModuleElement mdl : configuration.getSpecifiedModuleElements()) {
+            // If -nodeprecated option is set and the module is marked as deprecated,
+            // do not convert the module files to HTML.
+            if (!(configuration.nodeprecated && utils.isDeprecated(mdl)))
+                convertModule(mdl, outputdir);
+        }
         for (PackageElement pkg : configuration.getSpecifiedPackageElements()) {
             // If -nodeprecated option is set and the package is marked as deprecated,
             // do not convert the package files to HTML.
@@ -161,6 +168,27 @@
     }
 
     /**
+     * Convert the documented packages contained in the given module to an HTML representation.
+     *
+     * @param mdl the module to convert.
+     * @param outputdir the name of the directory to output to.
+     * @throws DocFileIOException if there is a problem generating an output file
+     * @throws SimpleDocletException if there is a problem reading a source file
+     */
+    public void convertModule(ModuleElement mdl, DocPath outputdir)
+            throws DocFileIOException, SimpleDocletException {
+        if (mdl == null) {
+            return;
+        }
+        for (Element elem : mdl.getEnclosedElements()) {
+            if (elem instanceof PackageElement && configuration.docEnv.isIncluded(elem)
+                    && !(configuration.nodeprecated && utils.isDeprecated(elem))) {
+                convertPackage((PackageElement) elem, outputdir);
+            }
+        }
+    }
+
+    /**
      * Convert the given Class to an HTML.
      *
      * @param te the class to convert.