8154261: Module summary page should display directives for the module
authorbpatel
Tue, 12 Jul 2016 12:55:18 -0700
changeset 39670 9d1eafbf29c6
parent 39601 5b37e511ae4b
child 39671 5a4b6a035514
8154261: Module summary page should display directives for the module Reviewed-by: jjg, ksrini
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SectionName.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlConstants.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ModuleSummaryWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
langtools/test/jdk/javadoc/doclet/testModules/module2/module-info.java
langtools/test/jdk/javadoc/doclet/testModules/module2/testpkg2mdl2/TestInterfaceInModule2.java
langtools/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/TestClassInModule2.java
langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue Jul 12 12:55:18 2016 -0700
@@ -458,17 +458,6 @@
     }
 
     /**
-     * Add gap between navigation bar elements.
-     *
-     * @param liNav the content tree to which the gap will be added
-     */
-    protected void addNavGap(Content liNav) {
-        liNav.addContent(getSpace());
-        liNav.addContent("|");
-        liNav.addContent(getSpace());
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Tue Jul 12 12:55:18 2016 -0700
@@ -764,17 +764,6 @@
     }
 
     /**
-     * Add gap between navigation bar elements.
-     *
-     * @param liNav the content tree to which the gap will be added
-     */
-    protected void addNavGap(Content liNav) {
-        liNav.addContent(getSpace());
-        liNav.addContent("|");
-        liNav.addContent(getSpace());
-    }
-
-    /**
      * Return the TypeElement being documented.
      *
      * @return the TypeElement being documented.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Tue Jul 12 12:55:18 2016 -0700
@@ -908,6 +908,17 @@
     }
 
     /**
+     * Add gap between navigation bar elements.
+     *
+     * @param liNav the content tree to which the gap will be added
+     */
+    protected void addNavGap(Content liNav) {
+        liNav.addContent(getSpace());
+        liNav.addContent("|");
+        liNav.addContent(getSpace());
+    }
+
+    /**
      * Get summary table header.
      *
      * @param header the header for the table
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Tue Jul 12 12:55:18 2016 -0700
@@ -26,23 +26,28 @@
 package jdk.javadoc.internal.doclets.formats.html;
 
 import java.io.*;
+import java.util.ArrayList;
+import java.util.EnumMap;
 import java.util.List;
-import java.util.Set;
+import java.util.Map;
 
 import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.ModuleElement.DirectiveKind;
 import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
 
 import com.sun.source.doctree.DocTree;
-
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 
 /**
  * Class to generate file for each module contents in the right-hand
@@ -74,17 +79,25 @@
      */
     protected ModuleElement mdle;
 
+    private final Map<ModuleElement.DirectiveKind, List<ModuleElement.Directive>> directiveMap
+            = new EnumMap<>(ModuleElement.DirectiveKind.class);
+
     /**
      * The HTML tree for main tag.
      */
     protected HtmlTree mainTree = HtmlTree.MAIN();
 
     /**
+     * The HTML tree for section tag.
+     */
+    protected HtmlTree sectionTree = HtmlTree.SECTION();
+
+    /**
      * Constructor to construct ModuleWriter object and to generate
      * "moduleName-summary.html" file.
      *
      * @param configuration the configuration of the doclet.
-     * @param module        Module under consideration.
+     * @param mdle        Module under consideration.
      * @param prevModule   Previous module in the sorted array.
      * @param nextModule   Next module in the sorted array.
      */
@@ -95,10 +108,13 @@
         this.prevModule = prevModule;
         this.nextModule = nextModule;
         this.mdle = mdle;
+        generateDirectiveMap();
     }
 
     /**
-     * {@inheritDoc}
+     * Get the module header.
+     *
+     * @param heading the heading for the section
      */
     public Content getModuleHeader(String heading) {
         HtmlTree bodyTree = getBody(true, getWindowTitle(mdle.getQualifiedName().toString()));
@@ -127,7 +143,7 @@
     }
 
     /**
-     * {@inheritDoc}
+     * Get the content header.
      */
     public Content getContentHeader() {
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
@@ -136,7 +152,7 @@
     }
 
     /**
-     * {@inheritDoc}
+     * Get the summary section header.
      */
     public Content getSummaryHeader() {
         HtmlTree li = new HtmlTree(HtmlTag.LI);
@@ -145,7 +161,9 @@
     }
 
     /**
-     * {@inheritDoc}
+     * Get the summary tree.
+     *
+     * @param summaryContentTree the content tree to be added to the summary tree.
      */
     public Content getSummaryTree(Content summaryContentTree) {
         HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
@@ -153,18 +171,315 @@
     }
 
     /**
+     * Generate the directive map for the directives on the module.
+     */
+    public void generateDirectiveMap() {
+        for (ModuleElement.Directive d : mdle.getDirectives()) {
+            if (directiveMap.containsKey(d.getKind())) {
+                List<ModuleElement.Directive> dir = directiveMap.get(d.getKind());
+                dir.add(d);
+                directiveMap.put(d.getKind(), dir);
+            } else {
+                List<ModuleElement.Directive> dir = new ArrayList<>();
+                dir.add(d);
+                directiveMap.put(d.getKind(), dir);
+            }
+        }
+    }
+
+    /**
+     * Add the summary header.
+     *
+     * @param startMarker the marker comment
+     * @param markerAnchor the marker anchor for the section
+     * @param heading the heading for the section
+     * @param htmltree the content tree to which the information is added
+     */
+    public void addSummaryHeader(Content startMarker, SectionName markerAnchor, Content heading, Content htmltree) {
+        htmltree.addContent(startMarker);
+        htmltree.addContent(getMarkerAnchor(markerAnchor));
+        htmltree.addContent(HtmlTree.HEADING(HtmlTag.H3, heading));
+    }
+
+    /**
+     * Add the summary for the module.
+     *
+     * @param text the table caption
+     * @param tableSummary the summary for the table
+     * @param htmltree the content tree to which the table will be added
+     * @param tableStyle the table style
+     * @param tableHeader the table header
+     * @param dirs the list of module directives
+     */
+    public void addSummary(String text, String tableSummary, Content htmltree, HtmlStyle tableStyle,
+            List<String> tableHeader, List<ModuleElement.Directive> dirs) {
+        Content table = (configuration.isOutputHtml5())
+                ? HtmlTree.TABLE(tableStyle, getTableCaption(new RawHtml(text)))
+                : HtmlTree.TABLE(tableStyle, tableSummary, getTableCaption(new RawHtml(text)));
+        table.addContent(getSummaryTableHeader(tableHeader, "col"));
+        Content tbody = new HtmlTree(HtmlTag.TBODY);
+        addList(dirs, tbody);
+        table.addContent(tbody);
+        htmltree.addContent(table);
+    }
+
+    /**
+     * Add the list of directives for the module.
+     *
+     * @param dirs the list of module directives
+     * @params tbody the content tree to which the list is added
+     */
+    public void addList(List<ModuleElement.Directive> dirs, Content tbody) {
+        boolean altColor = true;
+        for (ModuleElement.Directive direct : dirs) {
+            DirectiveKind kind = direct.getKind();
+            switch (kind) {
+                case REQUIRES:
+                    addRequiresList((ModuleElement.RequiresDirective) direct, tbody, altColor);
+                    break;
+                case EXPORTS:
+                    addExportedPackagesList((ModuleElement.ExportsDirective) direct, tbody, altColor);
+                    break;
+                case USES:
+                    addUsesList((ModuleElement.UsesDirective) direct, tbody, altColor);
+                    break;
+                case PROVIDES:
+                    addProvidesList((ModuleElement.ProvidesDirective) direct, tbody, altColor);
+                    break;
+                default:
+                    throw new AssertionError("unknown directive kind: " + kind);
+            }
+            altColor = !altColor;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addModulesSummary(Content summaryContentTree) {
+        List<ModuleElement.Directive> dirs = directiveMap.get(DirectiveKind.REQUIRES);
+        if (dirs != null && !dirs.isEmpty()) {
+            HtmlTree li = new HtmlTree(HtmlTag.LI);
+            li.addStyle(HtmlStyle.blockList);
+            addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
+                    getResource("doclet.navModules"), li);
+            String text = configuration.getText("doclet.Requires_Summary");
+            String tableSummary = configuration.getText("doclet.Member_Table_Summary",
+                    configuration.getText("doclet.Requires_Summary"),
+                    configuration.getText("doclet.modules"));
+            addRequiresSummary(text, tableSummary, dirs, li);
+            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
+            summaryContentTree.addContent(ul);
+        }
+    }
+
+    /**
+     * Add the requires summary for the module.
+     *
+     * @param text the table caption
+     * @param tableSummary the summary for the table
+     * @param dirs the list of module directives
+     * @param htmltree the content tree to which the table will be added
+     */
+    public void addRequiresSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
+            Content htmltree) {
+        addSummary(text, tableSummary, htmltree, HtmlStyle.requiresSummary, requiresTableHeader, dirs);
+    }
+
+    /**
+     * Add the requires directive list for the module.
+     *
+     * @param direct the requires directive
+     * @param tbody the content tree to which the directive will be added
+     * @param altColor true if altColor style should be used or false if rowColor style should be used
+     */
+    public void addRequiresList(ModuleElement.RequiresDirective direct, Content tbody, boolean altColor) {
+        ModuleElement m = direct.getDependency();
+        Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName().toString()));
+        Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, moduleLinkContent);
+        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+        tdSummary.addStyle(HtmlStyle.colLast);
+        addSummaryComment(m, tdSummary);
+        HtmlTree tr = HtmlTree.TR(tdPackage);
+        tr.addContent(tdSummary);
+        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+        tbody.addContent(tr);
+    }
+
+    /**
      * {@inheritDoc}
      */
-    public void addPackagesSummary(Set<PackageElement> packages, String text,
-            String tableSummary, Content summaryContentTree) {
-        Content table = (configuration.isOutputHtml5())
-                ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text)))
-                : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text)));
-        table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
-        Content tbody = new HtmlTree(HtmlTag.TBODY);
-        addPackagesList(packages, tbody);
-        table.addContent(tbody);
-        summaryContentTree.addContent(table);
+    public void addPackagesSummary(Content summaryContentTree) {
+        List<ModuleElement.Directive> dirs = directiveMap.get(DirectiveKind.EXPORTS);
+        if (dirs != null && !dirs.isEmpty()) {
+            HtmlTree li = new HtmlTree(HtmlTag.LI);
+            li.addStyle(HtmlStyle.blockList);
+            addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
+                    getResource("doclet.navPackages"), li);
+            String text = configuration.getText("doclet.Exported_Packages_Summary");
+            String tableSummary = configuration.getText("doclet.Member_Table_Summary",
+                    configuration.getText("doclet.Exported_Packages_Summary"),
+                    configuration.getText("doclet.packages"));
+            addExportedPackagesSummary(text, tableSummary, dirs, li);
+            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
+            summaryContentTree.addContent(ul);
+        }
+    }
+
+    /**
+     * Add the exported packages summary for the module.
+     *
+     * @param text the table caption
+     * @param tableSummary the summary for the table
+     * @param dirs the list of module directives
+     * @param htmltree the content tree to which the table will be added
+     */
+    public void addExportedPackagesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
+            Content htmltree) {
+        addSummary(text, tableSummary, htmltree, HtmlStyle.packagesSummary, exportedPackagesTableHeader, dirs);
+    }
+
+    /**
+     * Add the exported packages list for the module.
+     *
+     * @param direct the requires directive
+     * @param tbody the content tree to which the directive will be added
+     * @param altColor true if altColor style should be used or false if rowColor style should be used
+     */
+    public void addExportedPackagesList(ModuleElement.ExportsDirective direct, Content tbody, boolean altColor) {
+        PackageElement pkg = direct.getPackage();
+        Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
+        Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, pkgLinkContent);
+        HtmlTree tdModules = new HtmlTree(HtmlTag.TD);
+        tdModules.addStyle(HtmlStyle.colSecond);
+        List<? extends ModuleElement> targetModules = direct.getTargetModules();
+        if (targetModules != null) {
+            List<? extends ModuleElement> mElements = direct.getTargetModules();
+            for (int i = 0; i < mElements.size(); i++) {
+                if (i > 0) {
+                    tdModules.addContent(new HtmlTree(HtmlTag.BR));
+                }
+                ModuleElement m = mElements.get(i);
+                tdModules.addContent(new StringContent(m.getQualifiedName().toString()));
+            }
+        } else {
+            tdModules.addContent(configuration.getText("doclet.All_Modules"));
+        }
+        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+        tdSummary.addStyle(HtmlStyle.colLast);
+        addSummaryComment(pkg, tdSummary);
+        HtmlTree tr = HtmlTree.TR(tdPackage);
+        tr.addContent(tdModules);
+        tr.addContent(tdSummary);
+        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+        tbody.addContent(tr);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addServicesSummary(Content summaryContentTree) {
+        List<ModuleElement.Directive> usesDirs = directiveMap.get(DirectiveKind.USES);
+        List<ModuleElement.Directive> providesDirs = directiveMap.get(DirectiveKind.PROVIDES);
+        if ((usesDirs != null && !usesDirs.isEmpty()) || (providesDirs != null && !providesDirs.isEmpty())) {
+            HtmlTree li = new HtmlTree(HtmlTag.LI);
+            li.addStyle(HtmlStyle.blockList);
+            addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
+                    getResource("doclet.navServices"), li);
+            String text;
+            String tableSummary;
+            if (usesDirs != null && !usesDirs.isEmpty()) {
+                text = configuration.getText("doclet.Uses_Summary");
+                tableSummary = configuration.getText("doclet.Member_Table_Summary",
+                        configuration.getText("doclet.Uses_Summary"),
+                        configuration.getText("doclet.types"));
+                addUsesSummary(text, tableSummary, usesDirs, li);
+            }
+            if (providesDirs != null && !providesDirs.isEmpty()) {
+                text = configuration.getText("doclet.Provides_Summary");
+                tableSummary = configuration.getText("doclet.Member_Table_Summary",
+                        configuration.getText("doclet.Provides_Summary"),
+                        configuration.getText("doclet.types"));
+                addProvidesSummary(text, tableSummary, providesDirs, li);
+            }
+            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
+            summaryContentTree.addContent(ul);
+        }
+    }
+
+    /**
+     * Add the uses summary for the module.
+     *
+     * @param text the table caption
+     * @param tableSummary the summary for the table
+     * @param dirs the list of module directives
+     * @param htmltree the content tree to which the table will be added
+     */
+    public void addUsesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
+            Content htmltree) {
+        addSummary(text, tableSummary, htmltree, HtmlStyle.usesSummary, usesTableHeader, dirs);
+    }
+
+    /**
+     * Add the uses list for the module.
+     *
+     * @param direct the requires directive
+     * @param tbody the content tree to which the directive will be added
+     * @param altColor true if altColor style should be used or false if rowColor style should be used
+     */
+    public void addUsesList(ModuleElement.UsesDirective direct, Content tbody, boolean altColor) {
+        TypeElement type = direct.getService();
+        Content typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, type));
+        Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, typeLinkContent);
+        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+        tdSummary.addStyle(HtmlStyle.colLast);
+        addSummaryComment(type, tdSummary);
+        HtmlTree tr = HtmlTree.TR(tdPackage);
+        tr.addContent(tdSummary);
+        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+        tbody.addContent(tr);
+    }
+
+    /**
+     * Add the provides summary for the module.
+     *
+     * @param text the table caption
+     * @param tableSummary the summary for the table
+     * @param dirs the list of module directives
+     * @param htmltree the content tree to which the table will be added
+     */
+    public void addProvidesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
+            Content htmltree) {
+        addSummary(text, tableSummary, htmltree, HtmlStyle.providesSummary, providesTableHeader, dirs);
+    }
+
+    /**
+     * Add the exported packages list for the module.
+     *
+     * @param direct the requires directive
+     * @param tbody the content tree to which the directive will be added
+     * @param altColor true if altColor style should be used or false if rowColor style should be used
+     */
+    public void addProvidesList(ModuleElement.ProvidesDirective direct, Content tbody, boolean altColor) {
+        TypeElement impl = direct.getImplementation();
+        TypeElement srv = direct.getService();
+        Content implLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl));
+        Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv));
+        HtmlTree tdType = HtmlTree.TD(HtmlStyle.colFirst, srvLinkContent);
+        tdType.addContent(new HtmlTree(HtmlTag.BR));
+        tdType.addContent("(");
+        HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, getResource("doclet.Implementation"));
+        tdType.addContent(implSpan);
+        tdType.addContent(getSpace());
+        tdType.addContent(implLinkContent);
+        tdType.addContent(")");
+        HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
+        tdDesc.addStyle(HtmlStyle.colLast);
+        addSummaryComment(srv, tdDesc);
+        HtmlTree tr = HtmlTree.TR(tdType);
+        tr.addContent(tdDesc);
+        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+        tbody.addContent(tr);
     }
 
     /**
@@ -196,29 +511,56 @@
     }
 
     /**
-     * Adds list of packages in the package summary table. Generate link to each package.
+     * Add summary details to the navigation bar.
      *
-     * @param packages Packages to which link is to be generated
-     * @param tbody the documentation tree to which the list will be added
+     * @param subDiv the content tree to which the summary detail links will be added
+     */
+    protected void addSummaryDetailLinks(Content subDiv) {
+        try {
+            Content div = HtmlTree.DIV(getNavSummaryLinks());
+            subDiv.addContent(div);
+        } catch (Exception e) {
+            throw new DocletAbortException(e);
+        }
+    }
+
+    /**
+     * Get summary links for navigation bar.
+     *
+     * @return the content tree for the navigation summary links
      */
-    protected void addPackagesList(Set<PackageElement> packages, Content tbody) {
-        boolean altColor = true;
-        for (PackageElement pkg : packages) {
-            if (pkg != null && !pkg.isUnnamed()) {
-                if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
-                    Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
-                    Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
-                    HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
-                    tdSummary.addStyle(HtmlStyle.colLast);
-                    addSummaryComment(pkg, tdSummary);
-                    HtmlTree tr = HtmlTree.TR(tdPackage);
-                    tr.addContent(tdSummary);
-                    tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
-                    tbody.addContent(tr);
-                }
-            }
-            altColor = !altColor;
-        }
+    protected Content getNavSummaryLinks() throws Exception {
+        Content li = HtmlTree.LI(moduleSubNavLabel);
+        li.addContent(getSpace());
+        Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
+        Content liNav = new HtmlTree(HtmlTag.LI);
+        liNav.addContent(!utils.getBody(mdle).isEmpty() && !configuration.nocomment
+                ? getHyperLink(SectionName.MODULE_DESCRIPTION, getResource("doclet.navModuleDescription"))
+                : getResource("doclet.navModuleDescription"));
+        addNavGap(liNav);
+        liNav.addContent(showDirectives(DirectiveKind.REQUIRES)
+                ? getHyperLink(SectionName.MODULES, getResource("doclet.navModules"))
+                : getResource("doclet.navModules"));
+        addNavGap(liNav);
+        liNav.addContent(showDirectives(DirectiveKind.EXPORTS)
+                ? getHyperLink(SectionName.PACKAGES, getResource("doclet.navPackages"))
+                : getResource("doclet.navPackages"));
+        addNavGap(liNav);
+        liNav.addContent((showDirectives(DirectiveKind.USES) || showDirectives(DirectiveKind.PROVIDES))
+                ? getHyperLink(SectionName.SERVICES, getResource("doclet.navServices"))
+                : getResource("doclet.navServices"));
+        ulNav.addContent(liNav);
+        return ulNav;
+    }
+
+    /**
+     * Return true if the directive should be displayed.
+     *
+     * @param dirKind the kind of directive for the module
+     * @return true if the directive should be displayed
+     */
+    private boolean showDirectives(DirectiveKind dirKind) {
+        return directiveMap.get(dirKind) != null && !directiveMap.get(dirKind).isEmpty();
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SectionName.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SectionName.java	Tue Jul 12 12:55:18 2016 -0700
@@ -54,6 +54,9 @@
     METHODS_INHERITANCE("methods.inherited.from.class."),
     METHOD_SUMMARY("method.summary"),
     MODULE_DESCRIPTION("module.description"),
+    MODULES("modules.summary"),
+    PACKAGES("packages.summary"),
+    SERVICES("services.summary"),
     NAVBAR_BOTTOM("navbar.bottom"),
     NAVBAR_BOTTOM_FIRSTROW("navbar.bottom.firstrow"),
     NAVBAR_TOP("navbar.top"),
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlConstants.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlConstants.java	Tue Jul 12 12:55:18 2016 -0700
@@ -70,6 +70,24 @@
             new Comment("============ MODULE DESCRIPTION ===========");
 
     /**
+     * Marker to identify start of modules summary.
+     */
+    public static final Content START_OF_MODULES_SUMMARY =
+            new Comment("============ MODULES SUMMARY ===========");
+
+    /**
+     * Marker to identify start of packages summary.
+     */
+    public static final Content START_OF_PACKAGES_SUMMARY =
+            new Comment("============ PACKAGES SUMMARY ===========");
+
+    /**
+     * Marker to identify start of services summary.
+     */
+    public static final Content START_OF_SERVICES_SUMMARY =
+            new Comment("============ SERVICES SUMMARY ===========");
+
+    /**
      * Marker to identify start of class data.
      */
     public static final Content START_OF_CLASS_DATA =
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Tue Jul 12 12:55:18 2016 -0700
@@ -49,6 +49,7 @@
     colFirst,
     colLast,
     colOne,
+    colSecond,
     constantsSummary,
     constantValuesContainer,
     contentContainer,
@@ -65,6 +66,7 @@
     header,
     horizontal,
     footer,
+    implementationLabel,
     indexContainer,
     indexNav,
     inheritance,
@@ -87,7 +89,10 @@
     overviewSummary,
     packageHierarchyLabel,
     packageLabelInClass,
+    packagesSummary,
     paramLabel,
+    providesSummary,
+    requiresSummary,
     returnLabel,
     rightContainer,
     rightIframe,
@@ -111,5 +116,6 @@
     typeNameLabel,
     typeNameLink,
     typeSummary,
-    useSummary
+    useSummary,
+    usesSummary
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Tue Jul 12 12:55:18 2016 -0700
@@ -77,6 +77,26 @@
     protected final List<String> packageTableHeader;
 
     /**
+     * Header for tables displaying modules and description..
+     */
+    protected final List<String> requiresTableHeader;
+
+    /**
+     * Header for tables displaying packages and description..
+     */
+    protected final List<String> exportedPackagesTableHeader;
+
+    /**
+     * Header for tables displaying types and description..
+     */
+    protected final List<String> usesTableHeader;
+
+    /**
+     * Header for tables displaying types and description..
+     */
+    protected final List<String> providesTableHeader;
+
+    /**
      * Summary for use tables displaying class and package use.
      */
     protected final String useTableSummary;
@@ -108,6 +128,8 @@
 
     public final Content detailLabel;
 
+    public final Content moduleSubNavLabel;
+
     public final Content framesLabel;
 
     public final Content noframesLabel;
@@ -192,6 +214,19 @@
         packageTableHeader = new ArrayList<>();
         packageTableHeader.add(configuration.getText("doclet.Package"));
         packageTableHeader.add(configuration.getText("doclet.Description"));
+        requiresTableHeader = new ArrayList<>();
+        requiresTableHeader.add(configuration.getText("doclet.Module"));
+        requiresTableHeader.add(configuration.getText("doclet.Description"));
+        exportedPackagesTableHeader = new ArrayList<>();
+        exportedPackagesTableHeader.add(configuration.getText("doclet.Package"));
+        exportedPackagesTableHeader.add(configuration.getText("doclet.Module"));
+        exportedPackagesTableHeader.add(configuration.getText("doclet.Description"));
+        usesTableHeader = new ArrayList<>();
+        usesTableHeader.add(configuration.getText("doclet.Type"));
+        usesTableHeader.add(configuration.getText("doclet.Description"));
+        providesTableHeader = new ArrayList<>();
+        providesTableHeader.add(configuration.getText("doclet.Type"));
+        providesTableHeader.add(configuration.getText("doclet.Description"));
         useTableSummary = configuration.getText("doclet.Use_Table_Summary",
                 configuration.getText("doclet.packages"));
         modifierTypeHeader = configuration.getText("doclet.0_and_1",
@@ -208,6 +243,7 @@
         nextclassLabel = getNonBreakResource("doclet.Next_Class");
         summaryLabel = getResource("doclet.Summary");
         detailLabel = getResource("doclet.Detail");
+        moduleSubNavLabel = getResource("doclet.Module_Sub_Nav");
         framesLabel = getResource("doclet.Frames");
         noframesLabel = getNonBreakResource("doclet.No_Frames");
         treeLabel = getResource("doclet.Tree");
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Tue Jul 12 12:55:18 2016 -0700
@@ -31,6 +31,11 @@
 doclet.Href_Class_Or_Interface_Title=class or interface in {0}
 doclet.Summary=Summary:
 doclet.Detail=Detail:
+doclet.Module_Sub_Nav=Module:
+doclet.navModuleDescription=Description
+doclet.navModules=Modules
+doclet.navPackages=Packages
+doclet.navServices=Services
 doclet.navNested=Nested
 doclet.navAnnotationTypeOptionalMember=Optional
 doclet.navAnnotationTypeRequiredMember=Required
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ModuleSummaryWriter.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ModuleSummaryWriter.java	Tue Jul 12 12:55:18 2016 -0700
@@ -91,15 +91,25 @@
     public abstract void addModuleTags(Content moduleContentTree);
 
     /**
-     * Adds the table of packages to the documentation tree.
+     * Adds the modules summary to the documentation tree.
      *
-     * @param packages the set of packages that should be added.
-     * @param label the label for this table.
-     * @param tableSummary the summary string for the table
      * @param summaryContentTree the content tree to which the summary will be added
      */
-    public abstract void addPackagesSummary(Set<PackageElement> packages, String label,
-            String tableSummary, Content summaryContentTree);
+    public abstract void addModulesSummary(Content summaryContentTree);
+
+    /**
+     * Adds the packages summary to the documentation tree.
+     *
+     * @param summaryContentTree the content tree to which the summary will be added
+     */
+    public abstract void addPackagesSummary(Content summaryContentTree);
+
+    /**
+     * Adds the services summary to the documentation tree.
+     *
+     * @param summaryContentTree the content tree to which the summary will be added
+     */
+    public abstract void addServicesSummary(Content summaryContentTree);
 
     /**
      * Adds the module content tree to the documentation tree.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java	Tue Jul 12 12:55:18 2016 -0700
@@ -167,23 +167,34 @@
     }
 
     /**
-     * Build the module package summary.
+     * Build the modules summary.
      *
      * @param node the XML element that specifies which components to document
      * @param summaryContentTree the content tree to which the summaries will
      *                           be added
      */
-    public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
-        Set<PackageElement> packages = configuration.modulePackages.get(mdle);
-        if (!packages.isEmpty()) {
-            String packageTableSummary
-                    = configuration.getText("doclet.Member_Table_Summary",
-                            configuration.getText("doclet.Package_Summary"),
-                            configuration.getText("doclet.packages"));
-            moduleWriter.addPackagesSummary(
-                    packages, configuration.getText("doclet.Package_Summary"),
-                    packageTableSummary, summaryContentTree);
+    public void buildModulesSummary(XMLNode node, Content summaryContentTree) {
+        moduleWriter.addModulesSummary(summaryContentTree);
+    }
+
+    /**
+     * Build the package summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the content tree to which the summaries will be added
+     */
+    public void buildPackagesSummary(XMLNode node, Content summaryContentTree) {
+        moduleWriter.addPackagesSummary(summaryContentTree);
         }
+
+    /**
+     * Build the services summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the content tree to which the summaries will be added
+     */
+    public void buildServicesSummary(XMLNode node, Content summaryContentTree) {
+        moduleWriter.addServicesSummary(summaryContentTree);
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml	Tue Jul 12 12:55:18 2016 -0700
@@ -33,7 +33,9 @@
             <ModuleDescription/>
             <ModuleTags/>
             <Summary>
-                <PackageSummary/>
+                <ModulesSummary/>
+                <PackagesSummary/>
+                <ServicesSummary/>
             </Summary>
         </Content>
     </ModuleDoc>
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Tue Jul 12 12:55:18 2016 -0700
@@ -69,6 +69,10 @@
 doclet.tag_misuse=Tag {0} cannot be used in {1} documentation.  It can only be used in the following types of documentation: {2}.
 doclet.javafx_tag_misuse=Tags @propertyGetter, @propertySetter and @propertyDescription can only be used in JavaFX properties getters and setters.
 doclet.Package_Summary=Package Summary
+doclet.Requires_Summary=Requires
+doclet.Exported_Packages_Summary=Exported Packages
+doclet.Uses_Summary=Uses
+doclet.Provides_Summary=Provides
 doclet.Module_Summary=Module Summary
 doclet.Interface_Summary=Interface Summary
 doclet.Annotation_Types_Summary=Annotation Types Summary
@@ -93,6 +97,7 @@
 doclet.Packages=Packages
 doclet.packages=packages
 doclet.modules=modules
+doclet.types=types
 doclet.All_Classes=All Classes
 doclet.All_Superinterfaces=All Superinterfaces:
 doclet.All_Implemented_Interfaces=All Implemented Interfaces:
@@ -170,6 +175,7 @@
 doclet.subinterfaces=subinterfaces
 doclet.Modifier=Modifier
 doclet.Type=Type
+doclet.Implementation=Implementation:
 doclet.Types=Types
 doclet.Members=Members
 doclet.SearchTags=SearchTags
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Tue Jul 12 12:55:18 2016 -0700
@@ -412,18 +412,20 @@
 /*
 Table styles
 */
-.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary {
+.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary,
+.requiresSummary, .packagesSummary, .providesSummary, .usesSummary {
     width:100%;
     border-spacing:0;
     border-left:1px solid #EEE; 
     border-right:1px solid #EEE; 
     border-bottom:1px solid #EEE; 
 }
-.overviewSummary, .memberSummary  {
+.overviewSummary, .memberSummary, .requiresSummary, .packagesSummary, .providesSummary, .usesSummary  {
     padding:0px;
 }
 .overviewSummary caption, .memberSummary caption, .typeSummary caption,
-.useSummary caption, .constantsSummary caption, .deprecatedSummary caption {
+.useSummary caption, .constantsSummary caption, .deprecatedSummary caption,
+.requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {
     position:relative;
     text-align:left;
     background-repeat:no-repeat;
@@ -439,16 +441,26 @@
 }
 .overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link,
 .useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link,
+.requiresSummary caption a:link, .packagesSummary caption a:link, providesSummary caption a:link,
+.usesSummary caption a:link,
 .overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover,
 .useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover,
+.requiresSummary caption a:hover, .packagesSummary caption a:hover, providesSummary caption a:hover,
+.usesSummary caption a:hover,
 .overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active,
 .useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active,
+.requiresSummary caption a:active, .packagesSummary caption a:active, providesSummary caption a:active,
+.usesSummary caption a:active,
 .overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited,
-.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited {
+.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited
+.requiresSummary caption a:visited, .packagesSummary caption a:visited, providesSummary caption a:visited,
+.usesSummary caption a:visited {
     color:#FFFFFF;
 }
 .overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,
-.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {
+.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span,
+.requiresSummary caption span, .packagesSummary caption span, .providesSummary caption span,
+.usesSummary caption span {
     white-space:nowrap;
     padding-top:5px;
     padding-left:12px;
@@ -491,7 +503,8 @@
     display:inline;
 }
 .overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd,
-.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd {
+.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd,
+.requiresSummary .tabEnd, .packagesSummary .tabEnd, .providesSummary .tabEnd, .usesSummary .tabEnd {
     display:none;
     width:5px;
     position:relative;
@@ -516,18 +529,19 @@
 
 }
 .overviewSummary td, .memberSummary td, .typeSummary td,
-.useSummary td, .constantsSummary td, .deprecatedSummary td {
+.useSummary td, .constantsSummary td, .deprecatedSummary td,
+.requiresSummary td, .packagesSummary td, .providesSummary td, .usesSummary td {
     text-align:left;
     padding:0px 0px 12px 10px;
 }
-th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
-td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
+th.colOne, th.colFirst, th.colSecond, th.colLast, .useSummary th, .constantsSummary th, .packagesSummary th,
+td.colOne, td.colFirst, td.colSecond, td.colLast, .useSummary td, .constantsSummary td {
     vertical-align:top;
     padding-right:0px;
     padding-top:8px;
     padding-bottom:3px;
 }
-th.colFirst, th.colLast, th.colOne, .constantsSummary th {
+th.colFirst, th.colSecond, th.colLast, th.colOne, .constantsSummary th, .packagesSummary th {
     background:#dee3e9;
     text-align:left;
     padding:8px 3px 3px 7px;
@@ -539,10 +553,19 @@
 td.colLast, th.colLast {
     font-size:13px;
 }
-td.colOne, th.colOne {
+td.colOne, th.colOne, .constantsSummary th, .packagesSummary th {
+    font-size:13px;
+}
+.providesSummary th.colFirst, .providesSummary th.colLast, .providesSummary td.colFirst,
+.providesSummary td.colLast {
+    white-space:normal;
+    width:50%;
     font-size:13px;
 }
 .overviewSummary td.colFirst, .overviewSummary th.colFirst,
+.requiresSummary td.colFirst, .requiresSummary th.colFirst,
+.packagesSummary td.colFirst, .packagesSummary td.colSecond, .packagesSummary th.colFirst, .packagesSummary th,
+.usesSummary td.colFirst, .usesSummary th.colFirst,
 .useSummary td.colFirst, .useSummary th.colFirst,
 .overviewSummary td.colOne, .overviewSummary th.colOne,
 .memberSummary td.colFirst, .memberSummary th.colFirst,
@@ -551,7 +574,7 @@
     width:25%;
     vertical-align:top;
 }
-td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
+td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colSecond a:link, td.colSecond a:active, td.colSecond a:visited, td.colSecond a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
     font-weight:bold;
 }
 .tableSubHeadingColor {
@@ -611,7 +634,7 @@
     margin:3px 10px 2px 0px;
     color:#474747;
 }
-.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink,
+.deprecatedLabel, .descfrmTypeLabel, .implementationLabel, .memberNameLabel, .memberNameLink,
 .moduleLabelInClass, .overrideSpecifyLabel, .packageLabelInClass,
 .packageHierarchyLabel, .paramLabel, .returnLabel, .seeLabel, .simpleTagLabel,
 .throwsLabel, .typeNameLabel, .typeNameLink, .searchTagLink {
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Tue Jul 12 12:55:18 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8154119 8154262 8156077 8157987
+ * @bug 8154119 8154262 8156077 8157987 8154261
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -110,6 +110,17 @@
         testModuleTags();
     }
 
+    @Test
+    void test7() {
+        javadoc("-d", "out-moduleSummary", "-use",
+                "-modulesourcepath", testSrc,
+                "-addmods", "module1,module2",
+                "testpkgmdl1", "testpkgmdl2", "testpkg2mdl2");
+        checkExit(Exit.OK);
+        testModuleSummary();
+        testNegatedModuleSummary();
+    }
+
    @Test
     void test8() {
         javadoc("-d", "out-html5-nomodule", "-html5", "-use",
@@ -139,12 +150,16 @@
                 "<div class=\"contentContainer\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
-                + "<table class=\"overviewSummary\" summary=\"Package Summary table, listing packages, and an explanation\">");
+                + "<ul class=\"blockList\">\n"
+                + "<li class=\"blockList\">\n"
+                + "<!-- ============ MODULES SUMMARY =========== -->");
         checkOutput("module2-summary.html", found,
                 "<div class=\"contentContainer\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
-                + "<table class=\"overviewSummary\" summary=\"Package Summary table, listing packages, and an explanation\">");
+                + "<ul class=\"blockList\">\n"
+                + "<li class=\"blockList\">\n"
+                + "<!-- ============ MODULES SUMMARY =========== -->");
     }
 
     void testHtml5Description(boolean found) {
@@ -171,12 +186,16 @@
                 "<div class=\"contentContainer\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
-                + "<table class=\"overviewSummary\">");
+                + "<ul class=\"blockList\">\n"
+                + "<li class=\"blockList\">\n"
+                + "<!-- ============ MODULES SUMMARY =========== -->");
         checkOutput("module2-summary.html", found,
                 "<div class=\"contentContainer\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
-                + "<table class=\"overviewSummary\">");
+                + "<ul class=\"blockList\">\n"
+                + "<li class=\"blockList\">\n"
+                + "<!-- ============ MODULES SUMMARY =========== -->");
     }
 
     void testModuleLink() {
@@ -313,4 +332,114 @@
                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                 + "</tr>");
     }
+
+    void testModuleSummary() {
+        checkOutput("module1-summary.html", true,
+                "<ul class=\"subNavList\">\n"
+                + "<li>Module:&nbsp;</li>\n"
+                + "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;<a "
+                + "href=\"#modules.summary\">Modules</a>&nbsp;|&nbsp;<a href=\"#packages.summary\">"
+                + "Packages</a>&nbsp;|&nbsp;Services</li>\n"
+                + "</ul>");
+        checkOutput("module1-summary.html", true,
+                "<!-- ============ MODULES SUMMARY =========== -->\n"
+                + "<a name=\"modules.summary\">\n"
+                + "<!--   -->\n"
+                + "</a>");
+        checkOutput("module1-summary.html", true,
+                "<tr class=\"altColor\">\n"
+                + "<td class=\"colFirst\"><a href=\"testpkgmdl1/package-summary.html\">testpkgmdl1</a></td>\n"
+                + "<td class=\"colSecond\">All Modules</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>\n"
+                + "</tr>");
+        checkOutput("module1-summary.html", true,
+                "<!-- ============ PACKAGES SUMMARY =========== -->\n"
+                + "<a name=\"packages.summary\">\n"
+                + "<!--   -->\n"
+                + "</a>");
+        checkOutput("module1-summary.html", true,
+                "<tr class=\"rowColor\">\n"
+                + "<td class=\"colFirst\"><a href=\"module2-summary.html\">module2</a></td>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the module2 module.</div>\n"
+                + "</td>\n"
+                + "</tr>");
+        checkOutput("module2-summary.html", true,
+                "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;<a "
+                + "href=\"#modules.summary\">Modules</a>&nbsp;|&nbsp;<a href=\"#packages.summary\">"
+                + "Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">Services</a></li>");
+        checkOutput("module2-summary.html", true,
+                "<!-- ============ MODULES SUMMARY =========== -->\n"
+                + "<a name=\"modules.summary\">\n"
+                + "<!--   -->\n"
+                + "</a>");
+        checkOutput("module2-summary.html", true,
+                "<tr class=\"rowColor\">\n"
+                + "<td class=\"colFirst\">testpkg2mdl2</td>\n"
+                + "<td class=\"colSecond\">module1</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>\n"
+                + "</tr>");
+        checkOutput("module2-summary.html", true,
+                "<!-- ============ PACKAGES SUMMARY =========== -->\n"
+                + "<a name=\"packages.summary\">\n"
+                + "<!--   -->\n"
+                + "</a>");
+        checkOutput("module2-summary.html", true,
+                "<tr class=\"altColor\">\n"
+                + "<td class=\"colFirst\"><a href=\"java.base-summary.html\">java.base</a></td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>\n"
+                + "</tr>");
+        checkOutput("module2-summary.html", true,
+                "<!-- ============ SERVICES SUMMARY =========== -->\n"
+                + "<a name=\"services.summary\">\n"
+                + "<!--   -->\n"
+                + "</a>");
+        checkOutput("module2-summary.html", true,
+                "<tr class=\"altColor\">\n"
+                + "<td class=\"colFirst\"><a href=\"testpkgmdl2/TestClassInModule2.html\" "
+                + "title=\"class in testpkgmdl2\">TestClassInModule2</a></td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>\n"
+                + "</tr>");
+        checkOutput("module2-summary.html", true,
+                "<tr class=\"altColor\">\n"
+                + "<td class=\"colFirst\">testpkg2mdl2.TestInterfaceInModule2<br>(<span "
+                + "class=\"implementationLabel\">Implementation:</span>&nbsp;<a "
+                + "href=\"testpkgmdl2/TestClassInModule2.html\" title=\"class in testpkgmdl2\">"
+                + "TestClassInModule2</a>)</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>\n"
+                + "</tr");
+        checkOutput("module2-summary.html", true,
+                "<caption><span>Exported Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+                + "<th scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>");
+        checkOutput("module2-summary.html", true,
+                "<caption><span>Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>");
+        checkOutput("module2-summary.html", true,
+                "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Type</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>");
+        checkOutput("module2-summary.html", true,
+                "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Type</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>");
+    }
+
+    void testNegatedModuleSummary() {
+        checkOutput("module1-summary.html", false,
+                "<!-- ============ SERVICES SUMMARY =========== -->\n"
+                + "<a name=\"services.summary\">\n"
+                + "<!--   -->\n"
+                + "</a>");
+    }
 }
--- a/langtools/test/jdk/javadoc/doclet/testModules/module2/module-info.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testModules/module2/module-info.java	Tue Jul 12 12:55:18 2016 -0700
@@ -28,4 +28,10 @@
   */
 module module2 {
     exports testpkgmdl2;
+
+    exports testpkg2mdl2 to module1;
+
+    uses testpkgmdl2.TestClassInModule2;
+
+    provides testpkg2mdl2.TestInterfaceInModule2 with testpkgmdl2.TestClassInModule2;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/module2/testpkg2mdl2/TestInterfaceInModule2.java	Tue Jul 12 12:55:18 2016 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package testpkg2mdl2;
+
+public interface TestInterfaceInModule2 {
+    void testMethod();
+}
--- a/langtools/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/TestClassInModule2.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testModules/module2/testpkgmdl2/TestClassInModule2.java	Tue Jul 12 12:55:18 2016 -0700
@@ -24,5 +24,8 @@
  */
 package testpkgmdl2;
 
-public class TestClassInModule2 {
+import testpkg2mdl2.TestInterfaceInModule2;
+
+public class TestClassInModule2 implements TestInterfaceInModule2 {
+    void testMethod() {}
 }
--- a/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Mon Jul 11 15:27:52 2016 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Tue Jul 12 12:55:18 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461
+ * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261
  * @summary  Run tests on doclet stylesheet.
  * @author   jamieh
  * @library  ../lib
@@ -81,7 +81,8 @@
                 + "    list-style-type:disc;\n"
                 + "}",
                 ".overviewSummary caption, .memberSummary caption, .typeSummary caption,\n"
-                + ".useSummary caption, .constantsSummary caption, .deprecatedSummary caption {\n"
+                + ".useSummary caption, .constantsSummary caption, .deprecatedSummary caption,\n"
+                + ".requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {\n"
                 + "    position:relative;\n"
                 + "    text-align:left;\n"
                 + "    background-repeat:no-repeat;\n"
@@ -96,7 +97,9 @@
                 + "    white-space:pre;\n"
                 + "}",
                 ".overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,\n"
-                + ".useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {\n"
+                + ".useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span,\n"
+                + ".requiresSummary caption span, .packagesSummary caption span, .providesSummary caption span,\n"
+                + ".usesSummary caption span {\n"
                 + "    white-space:nowrap;\n"
                 + "    padding-top:5px;\n"
                 + "    padding-left:12px;\n"
@@ -132,6 +135,9 @@
                 + "}",
                 // Test the formatting styles for proper content display in use and constant values pages.
                 ".overviewSummary td.colFirst, .overviewSummary th.colFirst,\n"
+                + ".requiresSummary td.colFirst, .requiresSummary th.colFirst,\n"
+                + ".packagesSummary td.colFirst, .packagesSummary td.colSecond, .packagesSummary th.colFirst, .packagesSummary th,\n"
+                + ".usesSummary td.colFirst, .usesSummary th.colFirst,\n"
                 + ".useSummary td.colFirst, .useSummary th.colFirst,\n"
                 + ".overviewSummary td.colOne, .overviewSummary th.colOne,\n"
                 + ".memberSummary td.colFirst, .memberSummary th.colFirst,\n"
@@ -141,7 +147,8 @@
                 + "    vertical-align:top;\n"
                 + "}",
                 ".overviewSummary td, .memberSummary td, .typeSummary td,\n"
-                + ".useSummary td, .constantsSummary td, .deprecatedSummary td {\n"
+                + ".useSummary td, .constantsSummary td, .deprecatedSummary td,\n"
+                + ".requiresSummary td, .packagesSummary td, .providesSummary td, .usesSummary td {\n"
                 + "    text-align:left;\n"
                 + "    padding:0px 0px 12px 10px;\n"
                 + "}",