changeset 3832:209b0eab0e1f

8160196: Module summary page should display information based on "api" or "detail" mode. Reviewed-by: jjg, ksrini
author bpatel
date Fri, 16 Dec 2016 09:07:57 -0800
parents d5058f5f1584
children 8616f75828f2
files src/jdk.compiler/share/classes/com/sun/source/doctree/DocTree.java src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java src/jdk.compiler/share/classes/com/sun/source/doctree/ProvidesTree.java src/jdk.compiler/share/classes/com/sun/source/doctree/ThrowsTree.java src/jdk.compiler/share/classes/com/sun/source/doctree/UsesTree.java src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MethodTypes.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ModulePackageTypes.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/TableTabTypes.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java test/jdk/javadoc/doclet/testModules/TestModules.java test/jdk/javadoc/doclet/testModules/moduleA/concealedpkgmdlA/ConcealedClassInModuleA.java test/jdk/javadoc/doclet/testModules/moduleA/module-info.java test/jdk/javadoc/doclet/testModules/moduleB/module-info.java test/jdk/javadoc/doclet/testModules/moduleB/testpkg2mdlB/TestInterface2InModuleB.java test/jdk/javadoc/doclet/testModules/moduleB/testpkgmdlB/TestClass2InModuleB.java test/jdk/javadoc/doclet/testModules/moduleC/module-info.java test/jdk/javadoc/doclet/testModules/moduleC/testpkgmdlC/TestClassInModuleC.java test/jdk/javadoc/doclet/testModules/moduletags/module-info.java test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java test/tools/doclint/ProvidesTest.java test/tools/doclint/ProvidesTest.out test/tools/doclint/UsesTest.java test/tools/doclint/UsesTest.out test/tools/javac/doctree/DocCommentTester.java test/tools/javac/doctree/ProvidesTest.java test/tools/javac/doctree/UsesTest.java test/tools/javac/lib/DPrinter.java
diffstat 46 files changed, 2125 insertions(+), 478 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTree.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTree.java	Fri Dec 16 09:07:57 2016 -0800
@@ -150,6 +150,12 @@
         PARAM("param"),
 
         /**
+         * Used for instances of {@link ProvidesTree}
+         * representing an @provides tag.
+         */
+        PROVIDES("provides"),
+
+        /**
          * Used for instances of {@link ReferenceTree}
          * representing a reference to a element in the
          * Java programming language.
@@ -223,6 +229,12 @@
         UNKNOWN_INLINE_TAG,
 
         /**
+         * Used for instances of {@link UsesTree}
+         * representing an @uses tag.
+         */
+        USES("uses"),
+
+        /**
          * Used for instances of {@link ValueTree}
          * representing an @value tag.
          */
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Fri Dec 16 09:07:57 2016 -0800
@@ -185,6 +185,14 @@
     R visitParam(ParamTree node, P p);
 
     /**
+     * Visits a ProvidesTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
+    R visitProvides(ProvidesTree node, P p);
+
+    /**
      * Visits a ReferenceTree node.
      * @param node the node being visited
      * @param p a parameter value
@@ -281,6 +289,14 @@
     R visitUnknownInlineTag(UnknownInlineTagTree node, P p);
 
     /**
+     * Visits a UsesTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
+    R visitUses(UsesTree node, P p);
+
+    /**
      * Visits a ValueTree node.
      * @param node the node being visited
      * @param p a parameter value
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/ProvidesTree.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,51 @@
+/*
+ * 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 com.sun.source.doctree;
+
+import java.util.List;
+
+/**
+ *
+ * A tree node for a @provides block tag.
+ *
+ * <p>
+ * &#064;provides service-type description
+ *
+ * @since 9
+ */
+public interface ProvidesTree extends BlockTagTree {
+    /**
+     * Returns the name of the service type being documented.
+     * @return the name of the service type
+     */
+    ReferenceTree getServiceType();
+
+    /**
+     * Returns a description of the service type being provided by the module.
+     * @return the description
+     */
+    List<? extends DocTree> getDescription();
+}
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/ThrowsTree.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/ThrowsTree.java	Fri Dec 16 09:07:57 2016 -0800
@@ -40,13 +40,13 @@
  */
 public interface ThrowsTree extends BlockTagTree {
     /**
-     * Returns a name of the exception being documented.
+     * Returns the name of the exception being documented.
      * @return the name of the exception
      */
     ReferenceTree getExceptionName();
 
     /**
-     * Returns the description of the reasons why the
+     * Returns a description of the reasons why the
      * exception may be thrown.
      * @return the description
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/UsesTree.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,51 @@
+/*
+ * 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 com.sun.source.doctree;
+
+import java.util.List;
+
+/**
+ *
+ * A tree node for an @uses block tag.
+ *
+ * <p>
+ * &#064;uses service-type description
+ *
+ * @since 9
+ */
+public interface UsesTree extends BlockTagTree {
+    /**
+     * Returns the name of the service type being documented.
+     * @return the name of the service type
+     */
+    ReferenceTree getServiceType();
+
+    /**
+     * Returns a description of the use of service type within the module.
+     * @return the description
+     */
+    List<? extends DocTree> getDescription();
+}
--- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java	Fri Dec 16 09:07:57 2016 -0800
@@ -49,6 +49,7 @@
 import com.sun.source.doctree.LinkTree;
 import com.sun.source.doctree.LiteralTree;
 import com.sun.source.doctree.ParamTree;
+import com.sun.source.doctree.ProvidesTree;
 import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.doctree.ReturnTree;
 import com.sun.source.doctree.SeeTree;
@@ -61,6 +62,7 @@
 import com.sun.source.doctree.ThrowsTree;
 import com.sun.source.doctree.UnknownBlockTagTree;
 import com.sun.source.doctree.UnknownInlineTagTree;
+import com.sun.source.doctree.UsesTree;
 import com.sun.source.doctree.ValueTree;
 import com.sun.source.doctree.VersionTree;
 
@@ -217,6 +219,14 @@
     ParamTree newParamTree(boolean isTypeParameter, IdentifierTree name, List<? extends DocTree> description);
 
     /**
+     * Create a new {@code ProvidesTree} object, to represent a {@code @provides } tag.
+     * @param name the name of the service type
+     * @param description a description of the service being provided
+     * @return a {@code ProvidesTree} object
+     */
+    ProvidesTree newProvidesTree(ReferenceTree name, List<? extends DocTree> description);
+
+    /**
      * Create a new {@code ReferenceTree} object, to represent a reference to an API element.
      *
      * @param signature the doc comment signature of the reference
@@ -309,6 +319,14 @@
     UnknownInlineTagTree newUnknownInlineTagTree(Name name, List<? extends DocTree> content);
 
     /**
+     * Create a new {@code UsesTree} object, to represent a {@code @uses } tag.
+     * @param name the name of the service type
+     * @param description a description of how the service will be used
+     * @return a {@code UsesTree} object
+     */
+    UsesTree newUsesTree(ReferenceTree name, List<? extends DocTree> description);
+
+    /**
      * Create a new {@code ValueTree} object, to represent a {@code {@value } } tag.
      * @param ref a reference to the value
      * @return a {@code ValueTree} object
--- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java	Fri Dec 16 09:07:57 2016 -0800
@@ -26,7 +26,6 @@
 package com.sun.source.util;
 
 import com.sun.source.doctree.*;
-import com.sun.tools.javac.tree.DCTree.DCIndex;
 
 
 /**
@@ -326,6 +325,20 @@
     }
 
     /**
+     * {@inheritDoc} This implementation scans the children in left to right order.
+     *
+     * @param node  {@inheritDoc}
+     * @param p  {@inheritDoc}
+     * @return the result of scanning
+     */
+    @Override
+    public R visitProvides(ProvidesTree node, P p) {
+        R r = scan(node.getServiceType(), p);
+        r = scanAndReduce(node.getDescription(), p, r);
+        return r;
+    }
+
+    /**
      * {@inheritDoc} This implementation returns {@code null}.
      *
      * @param node  {@inheritDoc}
@@ -482,6 +495,20 @@
      * @return the result of scanning
      */
     @Override
+    public R visitUses(UsesTree node, P p) {
+        R r = scan(node.getServiceType(), p);
+        r = scanAndReduce(node.getDescription(), p, r);
+        return r;
+    }
+
+    /**
+     * {@inheritDoc} This implementation scans the children in left to right order.
+     *
+     * @param node  {@inheritDoc}
+     * @param p  {@inheritDoc}
+     * @return the result of scanning
+     */
+    @Override
     public R visitValue(ValueTree node, P p) {
         return scan(node.getReference(), p);
     }
--- a/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Fri Dec 16 09:07:57 2016 -0800
@@ -210,6 +210,7 @@
      * @param p {@inheritDoc}
      * @return the result of {@code defaultAction}
      */
+    @Override
     public R visitHidden(HiddenTree node, P p) {
         return defaultAction(node, p);
     }
@@ -294,6 +295,18 @@
      * @return  the result of {@code defaultAction}
      */
     @Override
+    public R visitProvides(ProvidesTree node, P p) {
+        return defaultAction(node, p);
+    }
+
+    /**
+     * {@inheritDoc} This implementation calls {@code defaultAction}.
+     *
+     * @param node {@inheritDoc}
+     * @param p {@inheritDoc}
+     * @return  the result of {@code defaultAction}
+     */
+    @Override
     public R visitReference(ReferenceTree node, P p) {
         return defaultAction(node, p);
     }
@@ -438,6 +451,18 @@
      * @return  the result of {@code defaultAction}
      */
     @Override
+    public R visitUses(UsesTree node, P p) {
+        return defaultAction(node, p);
+    }
+
+    /**
+     * {@inheritDoc} This implementation calls {@code defaultAction}.
+     *
+     * @param node {@inheritDoc}
+     * @param p {@inheritDoc}
+     * @return  the result of {@code defaultAction}
+     */
+    @Override
     public R visitValue(ValueTree node, P p) {
         return defaultAction(node, p);
     }
--- a/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java	Fri Dec 16 09:07:57 2016 -0800
@@ -63,6 +63,7 @@
 import com.sun.source.doctree.LinkTree;
 import com.sun.source.doctree.LiteralTree;
 import com.sun.source.doctree.ParamTree;
+import com.sun.source.doctree.ProvidesTree;
 import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.doctree.ReturnTree;
 import com.sun.source.doctree.SerialDataTree;
@@ -73,6 +74,7 @@
 import com.sun.source.doctree.ThrowsTree;
 import com.sun.source.doctree.UnknownBlockTagTree;
 import com.sun.source.doctree.UnknownInlineTagTree;
+import com.sun.source.doctree.UsesTree;
 import com.sun.source.doctree.ValueTree;
 import com.sun.source.doctree.VersionTree;
 import com.sun.source.tree.Tree;
@@ -85,6 +87,7 @@
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.StringUtils;
+
 import static com.sun.tools.doclint.Messages.Group.*;
 
 
@@ -131,7 +134,7 @@
         }
     }
 
-    private Deque<TagStackItem> tagStack; // TODO: maybe want to record starting tree as well
+    private final Deque<TagStackItem> tagStack; // TODO: maybe want to record starting tree as well
     private HtmlTag currHeaderTag;
 
     private final int implicitHeaderLevel;
@@ -824,6 +827,20 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public Void visitProvides(ProvidesTree tree, Void ignore) {
+        Element e = env.trees.getElement(env.currPath);
+        if (e.getKind() != ElementKind.MODULE) {
+            env.messages.error(REFERENCE, tree, "dc.invalid.provides");
+        }
+        ReferenceTree serviceType = tree.getServiceType();
+        Element se = env.trees.getElement(new DocTreePath(getCurrentPath(), serviceType));
+        if (se == null) {
+            env.messages.error(REFERENCE, tree, "dc.service.not.found");
+        }
+        return super.visitProvides(tree, ignore);
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitReference(ReferenceTree tree, Void ignore) {
         String sig = tree.getSignature();
         if (sig.contains("<") || sig.contains(">"))
@@ -938,6 +955,20 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public Void visitUses(UsesTree tree, Void ignore) {
+        Element e = env.trees.getElement(env.currPath);
+        if (e.getKind() != ElementKind.MODULE) {
+            env.messages.error(REFERENCE, tree, "dc.invalid.uses");
+        }
+        ReferenceTree serviceType = tree.getServiceType();
+        Element se = env.trees.getElement(new DocTreePath(getCurrentPath(), serviceType));
+        if (se == null) {
+            env.messages.error(REFERENCE, tree, "dc.service.not.found");
+        }
+        return super.visitUses(tree, ignore);
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitValue(ValueTree tree, Void ignore) {
         ReferenceTree ref = tree.getReference();
         if (ref == null || ref.getSignature().isEmpty()) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties	Fri Dec 16 09:07:57 2016 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 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
@@ -41,8 +41,10 @@
 dc.exception.not.thrown = exception not thrown: {0}
 dc.invalid.anchor = invalid name for anchor: "{0}"
 dc.invalid.param = invalid use of @param
+dc.invalid.provides = invalid use of @provides
 dc.invalid.return = invalid use of @return
 dc.invalid.throws = invalid use of @throws
+dc.invalid.uses = invalid use of @uses
 dc.invalid.uri = invalid uri: "{0}"
 dc.missing.comment = no comment
 dc.missing.param = no @param for {0}
@@ -52,6 +54,7 @@
 dc.no.summary.or.caption.for.table=no summary or caption for table
 dc.param.name.not.found = @param name not found
 dc.ref.not.found = reference not found
+dc.service.not.found = service-type not found
 dc.tag.code.within.code = '{@code'} within <code>
 dc.tag.empty = empty <{0}> tag
 dc.tag.end.not.permitted = invalid end tag: </{0}>
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Fri Dec 16 09:07:57 2016 -0800
@@ -1160,6 +1160,16 @@
                 }
             },
 
+            // @provides service-name description
+            new TagParser(Kind.BLOCK, DCTree.Kind.PROVIDES) {
+                public DCTree parse(int pos) throws ParseException {
+                    skipWhitespace();
+                    DCReference ref = reference(true);
+                    List<DCTree> description = blockContent();
+                    return m.at(pos).newProvidesTree(ref, description);
+                }
+            },
+
             // @return description
             new TagParser(Kind.BLOCK, DCTree.Kind.RETURN) {
                 public DCTree parse(int pos) {
@@ -1261,6 +1271,16 @@
                 }
             },
 
+            // @uses service-name description
+            new TagParser(Kind.BLOCK, DCTree.Kind.USES) {
+                public DCTree parse(int pos) throws ParseException {
+                    skipWhitespace();
+                    DCReference ref = reference(true);
+                    List<DCTree> description = blockContent();
+                    return m.at(pos).newUsesTree(ref, description);
+                }
+            },
+
             // {@value package.class#field}
             new TagParser(Kind.INLINE, DCTree.Kind.VALUE) {
                 public DCTree parse(int pos) throws ParseException {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Fri Dec 16 09:07:57 2016 -0800
@@ -574,6 +574,36 @@
         }
     }
 
+    public static class DCProvides extends DCBlockTag implements ProvidesTree {
+        public final DCReference serviceType;
+        public final List<DCTree> description;
+
+        DCProvides(DCReference serviceType, List<DCTree> description) {
+            this.serviceType = serviceType;
+            this.description = description;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public Kind getKind() {
+            return Kind.PROVIDES;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
+            return v.visitProvides(this, d);
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public ReferenceTree getServiceType() {
+            return serviceType;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public List<? extends DocTree> getDescription() {
+            return description;
+        }
+    }
+
     public static class DCReference extends DCEndPosTree<DCReference> implements ReferenceTree {
         public final String signature;
 
@@ -912,6 +942,36 @@
         }
     }
 
+    public static class DCUses extends DCBlockTag implements UsesTree {
+        public final DCReference serviceType;
+        public final List<DCTree> description;
+
+        DCUses(DCReference serviceType, List<DCTree> description) {
+            this.serviceType = serviceType;
+            this.description = description;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public Kind getKind() {
+            return Kind.USES;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
+            return v.visitUses(this, d);
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public ReferenceTree getServiceType() {
+            return serviceType;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public List<? extends DocTree> getDescription() {
+            return description;
+        }
+    }
+
     public static class DCValue extends DCInlineTag implements ValueTree {
         public final DCReference ref;
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java	Fri Dec 16 09:07:57 2016 -0800
@@ -129,8 +129,7 @@
         }
     }
 
-
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitAttribute(AttributeTree node, Void p) {
         try {
             print(node.getName());
@@ -162,7 +161,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitAuthor(AuthorTree node, Void p) {
         try {
             printTagName(node);
@@ -174,7 +173,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitComment(CommentTree node, Void p) {
         try {
             print(node.getBody());
@@ -184,7 +183,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitDeprecated(DeprecatedTree node, Void p) {
         try {
             printTagName(node);
@@ -198,7 +197,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitDocComment(DocCommentTree node, Void p) {
         try {
             List<? extends DocTree> b = node.getFullBody();
@@ -213,7 +212,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitDocRoot(DocRootTree node, Void p) {
         try {
             print("{");
@@ -225,7 +224,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitEndElement(EndElementTree node, Void p) {
         try {
             print("</");
@@ -237,7 +236,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitEntity(EntityTree node, Void p) {
         try {
             print("&");
@@ -249,7 +248,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitErroneous(ErroneousTree node, Void p) {
         try {
             print(node.getBody());
@@ -259,7 +258,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitHidden(HiddenTree node, Void p) {
         try {
             printTagName(node);
@@ -273,7 +272,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitIdentifier(IdentifierTree node, Void p) {
         try {
             print(node.getName());
@@ -283,7 +282,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitIndex(IndexTree node, Void p) {
         try {
             print("{");
@@ -301,7 +300,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitInheritDoc(InheritDocTree node, Void p) {
         try {
             print("{");
@@ -313,7 +312,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitLink(LinkTree node, Void p) {
         try {
             print("{");
@@ -331,7 +330,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitLiteral(LiteralTree node, Void p) {
         try {
             print("{");
@@ -348,7 +347,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitParam(ParamTree node, Void p) {
         try {
             printTagName(node);
@@ -366,7 +365,23 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public Void visitProvides(ProvidesTree node, Void p) {
+        try {
+            printTagName(node);
+            print(" ");
+            print(node.getServiceType());
+            if (!node.getDescription().isEmpty()) {
+                print(" ");
+                print(node.getDescription());
+            }
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+        return null;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitReference(ReferenceTree node, Void p) {
         try {
             print(node.getSignature());
@@ -376,7 +391,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitReturn(ReturnTree node, Void p) {
         try {
             printTagName(node);
@@ -388,7 +403,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSee(SeeTree node, Void p) {
         try {
             printTagName(node);
@@ -406,7 +421,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerial(SerialTree node, Void p) {
         try {
             printTagName(node);
@@ -420,7 +435,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerialData(SerialDataTree node, Void p) {
         try {
             printTagName(node);
@@ -434,7 +449,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSerialField(SerialFieldTree node, Void p) {
         try {
             printTagName(node);
@@ -452,7 +467,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitSince(SinceTree node, Void p) {
         try {
             printTagName(node);
@@ -464,7 +479,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitStartElement(StartElementTree node, Void p) {
         try {
             print("<");
@@ -487,7 +502,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitText(TextTree node, Void p) {
         try {
             print(node.getBody());
@@ -497,7 +512,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitThrows(ThrowsTree node, Void p) {
         try {
             printTagName(node);
@@ -513,7 +528,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitUnknownBlockTag(UnknownBlockTagTree node, Void p) {
         try {
             print("@");
@@ -526,7 +541,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitUnknownInlineTag(UnknownInlineTagTree node, Void p) {
         try {
             print("{");
@@ -541,7 +556,23 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public Void visitUses(UsesTree node, Void p) {
+        try {
+            printTagName(node);
+            print(" ");
+            print(node.getServiceType());
+            if (!node.getDescription().isEmpty()) {
+                print(" ");
+                print(node.getDescription());
+            }
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+        return null;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitValue(ValueTree node, Void p) {
         try {
             print("{");
@@ -557,7 +588,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitVersion(VersionTree node, Void p) {
         try {
             printTagName(node);
@@ -569,7 +600,7 @@
         return null;
     }
 
-    @DefinedBy(Api.COMPILER_TREE)
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitOther(DocTree node, Void p) {
         try {
             print("(UNKNOWN: " + node + ")");
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Fri Dec 16 09:07:57 2016 -0800
@@ -44,6 +44,8 @@
 import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.doctree.StartElementTree;
 import com.sun.source.doctree.TextTree;
+import com.sun.source.doctree.ProvidesTree;
+import com.sun.source.doctree.UsesTree;
 import com.sun.source.util.DocTreeFactory;
 import com.sun.tools.doclint.HtmlTag;
 import com.sun.tools.javac.api.JavacTrees;
@@ -67,6 +69,7 @@
 import com.sun.tools.javac.tree.DCTree.DCLink;
 import com.sun.tools.javac.tree.DCTree.DCLiteral;
 import com.sun.tools.javac.tree.DCTree.DCParam;
+import com.sun.tools.javac.tree.DCTree.DCProvides;
 import com.sun.tools.javac.tree.DCTree.DCReference;
 import com.sun.tools.javac.tree.DCTree.DCReturn;
 import com.sun.tools.javac.tree.DCTree.DCSee;
@@ -79,6 +82,7 @@
 import com.sun.tools.javac.tree.DCTree.DCThrows;
 import com.sun.tools.javac.tree.DCTree.DCUnknownBlockTag;
 import com.sun.tools.javac.tree.DCTree.DCUnknownInlineTag;
+import com.sun.tools.javac.tree.DCTree.DCUses;
 import com.sun.tools.javac.tree.DCTree.DCValue;
 import com.sun.tools.javac.tree.DCTree.DCVersion;
 import com.sun.tools.javac.util.Context;
@@ -334,6 +338,13 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCProvides newProvidesTree(ReferenceTree name, List<? extends DocTree> description) {
+        DCProvides tree = new DCProvides((DCReference) name, cast(description));
+        tree.pos = pos;
+        return tree;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public DCReference newReferenceTree(String signature) {
         try {
             ReferenceParser.Reference ref = referenceParser.parse(signature);
@@ -430,6 +441,13 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCUses newUsesTree(ReferenceTree name, List<? extends DocTree> description) {
+        DCUses tree = new DCUses((DCReference) name, cast(description));
+        tree.pos = pos;
+        return tree;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public DCValue newValueTree(ReferenceTree ref) {
         // TODO: verify the reference is to a constant value
         DCValue tree = new DCValue((DCReference) ref);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Fri Dec 16 09:07:57 2016 -0800
@@ -36,7 +36,6 @@
 import javax.lang.model.type.TypeMirror;
 
 import com.sun.source.doctree.DocTree;
-
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
@@ -534,19 +533,19 @@
         writer.addSummaryLinkComment(this, member, firstSentenceTags, tdDesc);
         tr.addContent(tdDesc);
         if (utils.isMethod(member) && !utils.isAnnotationType(member)) {
-            int methodType = utils.isStatic(member) ? MethodTypes.STATIC.value() :
-                    MethodTypes.INSTANCE.value();
+            int methodType = utils.isStatic(member) ? MethodTypes.STATIC.tableTabs().value() :
+                    MethodTypes.INSTANCE.tableTabs().value();
             if (utils.isInterface(member.getEnclosingElement())) {
                 methodType = utils.isAbstract(member)
-                        ? methodType | MethodTypes.ABSTRACT.value()
-                        : methodType | MethodTypes.DEFAULT.value();
+                        ? methodType | MethodTypes.ABSTRACT.tableTabs().value()
+                        : methodType | MethodTypes.DEFAULT.tableTabs().value();
             } else {
                 methodType = utils.isAbstract(member)
-                        ? methodType | MethodTypes.ABSTRACT.value()
-                        : methodType | MethodTypes.CONCRETE.value();
+                        ? methodType | MethodTypes.ABSTRACT.tableTabs().value()
+                        : methodType | MethodTypes.CONCRETE.tableTabs().value();
             }
             if (utils.isDeprecated(member) || utils.isDeprecated(typeElement)) {
-                methodType = methodType | MethodTypes.DEPRECATED.value();
+                methodType = methodType | MethodTypes.DEPRECATED.tableTabs().value();
             }
             methodTypesOr = methodTypesOr | methodType;
             String tableId = "i" + counter;
@@ -569,7 +568,7 @@
     public boolean showTabs() {
         int value;
         for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) {
-            value = type.value();
+            value = type.tableTabs().value();
             if ((value & methodTypesOr) == value) {
                 methodTypes.add(type);
             }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Fri Dec 16 09:07:57 2016 -0800
@@ -1135,8 +1135,10 @@
      * @return a content for the module link
      */
     public Content getModuleLink(ModuleElement mdle, Content label) {
-        return getHyperLink(pathToRoot.resolve(
-                DocPaths.moduleSummary(mdle)), label, "", "");
+        boolean included = utils.isIncluded(mdle);
+        return (included)
+                ? getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(mdle)), label, "", "")
+                : label;
     }
 
     public Content interfaceName(TypeElement typeElement, boolean qual) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Fri Dec 16 09:07:57 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -25,17 +25,24 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.util.ArrayList;
-import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
 
+import javax.lang.model.element.Element;
 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 javax.lang.model.util.ElementFilter;
 
 import com.sun.source.doctree.DocTree;
+import jdk.javadoc.doclet.DocletEnvironment.ModuleMode;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 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;
@@ -47,12 +54,12 @@
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
+import jdk.javadoc.internal.doclets.toolkit.util.ModulePackageTypes;
 
 /**
- * Class to generate file for each module contents in the right-hand
- * frame. This will list all the packages and Class Kinds in the module. A click on any
- * class-kind will update the frame with the clicked class-kind page. A click on any
- * package will update the frame with the clicked module package page.
+ * Class to generate file for each module contents in the right-hand frame. This will list all the
+ * required modules, packages and service types for the module. A click on any of the links will update
+ * the frame with the clicked element page.
  *
  *  <p><b>This is NOT part of any supported API.
  *  If you write code that depends on this, you do so at your own risk.
@@ -78,8 +85,82 @@
      */
     protected ModuleElement mdle;
 
-    private final Map<ModuleElement.DirectiveKind, List<ModuleElement.Directive>> directiveMap
-            = new EnumMap<>(ModuleElement.DirectiveKind.class);
+    /**
+     * The module mode for this javadoc run. It can be set to "api" or "all".
+     */
+    private final ModuleMode moduleMode;
+
+    /**
+     * Map of module elements and modifiers required by this module.
+     */
+    private final Map<ModuleElement, Content> requires
+            = new TreeMap<>(utils.makeModuleComparator());
+
+    /**
+     * Map of additional modules and modifiers, transitive closure, required by this module.
+     */
+    private final Map<ModuleElement, Content> additionalModules
+            = new TreeMap<>(utils.makeModuleComparator());
+
+    /**
+     * Map of packages exported by this module and the modules it's been exported to.
+     */
+    private final Map<PackageElement, SortedSet<ModuleElement>> exportedPackages
+            = new TreeMap<>(utils.makePackageComparator());
+
+    /**
+     * Map of opened packages by this module and the modules it's been opened to.
+     */
+    private final Map<PackageElement, SortedSet<ModuleElement>> openedPackages
+            = new TreeMap<>(utils.makePackageComparator());
+
+    /**
+     * Set of concealed packages of this module.
+     */
+    private final SortedSet<PackageElement> concealedPackages = new TreeSet<>(utils.makePackageComparator());
+
+    /**
+     * Map of additional modules (transitive closure) and its exported packages.
+     */
+    private final Map<ModuleElement, SortedSet<PackageElement>> additionalPackages
+            = new TreeMap<>(utils.makeModuleComparator());
+
+    /**
+     * Map of additional modules (transitive closure) and its open packages.
+     */
+    private final Map<ModuleElement, SortedSet<PackageElement>> additionalOpenPackages
+            = new TreeMap<>(utils.makeModuleComparator());
+
+    /**
+     * Set of services used by the module.
+     */
+    private final SortedSet<TypeElement> uses
+            = new TreeSet<>(utils.makeAllClassesComparator());
+
+    /**
+     * Map of services used by the module and specified using @uses javadoc tag, and description.
+     */
+    private final Map<TypeElement, Content> usesTrees
+            = new TreeMap<>(utils.makeAllClassesComparator());
+
+    /**
+     * Map of services provided by this module, and set of its implementations.
+     */
+    private final Map<TypeElement, SortedSet<TypeElement>> provides
+            = new TreeMap<>(utils.makeAllClassesComparator());
+
+    /**
+     * Map of services provided by the module and specified using @provides javadoc tag, and
+     * description.
+     */
+    private final Map<TypeElement, Content> providesTrees
+            = new TreeMap<>(utils.makeAllClassesComparator());
+
+    private int packageTypesOr = 0;
+
+    protected Set<ModulePackageTypes> modulePackageTypes = EnumSet.noneOf(ModulePackageTypes.class);
+
+    protected Map<String, Integer> typeMap = new LinkedHashMap<>();
 
     /**
      * The HTML tree for main tag.
@@ -92,8 +173,7 @@
     protected HtmlTree sectionTree = HtmlTree.SECTION();
 
     /**
-     * Constructor to construct ModuleWriter object and to generate
-     * "moduleName-summary.html" file.
+     * Constructor to construct ModuleWriter object and to generate "moduleName-summary.html" file.
      *
      * @param configuration the configuration of the doclet.
      * @param mdle        Module under consideration.
@@ -106,7 +186,8 @@
         this.prevModule = prevModule;
         this.nextModule = nextModule;
         this.mdle = mdle;
-        generateDirectiveMap();
+        this.moduleMode = configuration.docEnv.getModuleMode();
+        computeModulesData();
     }
 
     /**
@@ -176,20 +257,165 @@
     }
 
     /**
-     * Generate the directive map for the directives on the module.
+     * Compute the modules data that will be displayed in various tables on the module summary page.
      */
-    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);
+    public void computeModulesData() {
+        CommentHelper ch = utils.getCommentHelper(mdle);
+        // Get module dependencies using the module's transitive closure.
+        Map<ModuleElement, String> dependentModules = utils.getDependentModules(mdle);
+        // Add all dependent modules to additional modules set. We will remove the modules,
+        // listed using the requires directive, from this set to come up with the table of additional
+        // required modules.
+        dependentModules.forEach((module, mod) -> {
+            if (shouldDocument(module)) {
+                additionalModules.put(module, new StringContent(mod));
+            }
+        });
+        (ElementFilter.requiresIn(mdle.getDirectives())).forEach((directive) -> {
+            ModuleElement m = directive.getDependency();
+            if (shouldDocument(m)) {
+                if (moduleMode == ModuleMode.ALL || directive.isTransitive()) {
+                    requires.put(m, new StringContent(utils.getModifiers(directive)));
             } else {
-                List<ModuleElement.Directive> dir = new ArrayList<>();
-                dir.add(d);
-                directiveMap.put(d.getKind(), dir);
+                // For api mode, just keep the public requires in dependentModules for display of
+                    // additional packages in the "Packages" section.
+                    dependentModules.remove(m);
             }
+                additionalModules.remove(m);
         }
+        });
+        // Get all packages for the module and put it in the concealed packages set.
+        (utils.getModulePackageMap().get(mdle)).forEach((pkg) -> {
+            if (shouldDocument(pkg)) {
+                concealedPackages.add(pkg);
+            }
+        });
+        // Get all exported packages for the module using the exports directive for the module.
+        (ElementFilter.exportsIn(mdle.getDirectives())).forEach((directive) -> {
+            PackageElement p = directive.getPackage();
+            if (shouldDocument(p)) {
+                SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
+                List<? extends ModuleElement> targetMdles = directive.getTargetModules();
+                if (targetMdles != null) {
+                    mdleList.addAll(targetMdles);
+                }
+                // Qualified exports should not be displayed in the api mode. So if mdleList is empty,
+                // its exported to all modules and hence can be added.
+                if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
+                    exportedPackages.put(p, mdleList);
+                }
+                concealedPackages.remove(p);
+            }
+        });
+        // Get all opened packages for the module using the opens directive for the module.
+        (ElementFilter.opensIn(mdle.getDirectives())).forEach((directive) -> {
+            PackageElement p = directive.getPackage();
+            if (shouldDocument(p)) {
+                SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
+                List<? extends ModuleElement> targetMdles = directive.getTargetModules();
+                if (targetMdles != null) {
+                    mdleList.addAll(targetMdles);
+                }
+                // Qualified opens should not be displayed in the api mode. So if mdleList is empty,
+                // it's opened to all modules and hence can be added.
+                if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
+                    openedPackages.put(p, mdleList);
+                }
+                concealedPackages.remove(p);
+            }
+        });
+        // Remove all the exported and opened packages so we have just the concealed packages now.
+        concealedPackages.removeAll(exportedPackages.keySet());
+        concealedPackages.removeAll(openedPackages.keySet());
+        // Get all the exported and opened packages, for the transitive closure of the module, to be displayed in
+        // the additional packages tables.
+        dependentModules.forEach((module, mod) -> {
+            SortedSet<PackageElement> pkgList = new TreeSet<>(utils.makePackageComparator());
+            (ElementFilter.exportsIn(module.getDirectives())).forEach((directive) -> {
+                PackageElement pkg = directive.getPackage();
+                if (shouldDocument(pkg)) {
+                    pkgList.add(pkg);
+                }
+            });
+            // If none of the transitive modules have exported packages to be displayed, we should not be
+            // displaying the table and so it should not be added to the map.
+            if (!pkgList.isEmpty()) {
+                additionalPackages.put(module, pkgList);
+            }
+            SortedSet<PackageElement> openPkgList = new TreeSet<>(utils.makePackageComparator());
+            (ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> {
+                PackageElement pkg = directive.getPackage();
+                if (shouldDocument(pkg)) {
+                    openPkgList.add(pkg);
+                }
+            });
+            // If none of the transitive modules have opened packages to be displayed, we should not be
+            // displaying the table and so it should not be added to the map.
+            if (!openPkgList.isEmpty()) {
+                additionalOpenPackages.put(module, openPkgList);
+            }
+        });
+        // Get all the services listed as uses directive.
+        (ElementFilter.usesIn(mdle.getDirectives())).forEach((directive) -> {
+            TypeElement u = directive.getService();
+            if (shouldDocument(u)) {
+                uses.add(u);
+            }
+        });
+        // Get all the services and implementations listed as provides directive.
+        (ElementFilter.providesIn(mdle.getDirectives())).forEach((directive) -> {
+            TypeElement u = directive.getService();
+            if (shouldDocument(u)) {
+                List<? extends TypeElement> implList = directive.getImplementations();
+                SortedSet<TypeElement> implSet = new TreeSet<>(utils.makeAllClassesComparator());
+                implSet.addAll(implList);
+                provides.put(u, implSet);
+            }
+        });
+        // Generate the map of all services listed using @provides, and the description.
+        (utils.getBlockTags(mdle, DocTree.Kind.PROVIDES)).forEach((tree) -> {
+            TypeElement t = ch.getServiceType(configuration, tree);
+            if (t != null) {
+                providesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false));
+            }
+        });
+        // Generate the map of all services listed using @uses, and the description.
+        (utils.getBlockTags(mdle, DocTree.Kind.USES)).forEach((tree) -> {
+            TypeElement t = ch.getServiceType(configuration, tree);
+            if (t != null) {
+                usesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false));
+            }
+        });
+    }
+
+    /**
+     * Returns true if the element should be documented on the module summary page.
+     *
+     * @param element the element to be checked
+     * @return true if the element should be documented
+     */
+    public boolean shouldDocument(Element element) {
+        return (moduleMode == ModuleMode.ALL || utils.isIncluded(element));
+    }
+
+    /**
+     * Returns true if there are elements to be displayed.
+     *
+     * @param section set of elements
+     * @return true if there are elements to be displayed
+     */
+    public boolean display(SortedSet<? extends Element> section) {
+        return section != null && !section.isEmpty();
+    }
+
+    /**
+     * Returns true if there are elements to be displayed.
+     *
+     * @param section map of elements.
+     * @return true if there are elements to be displayed
+     */
+    public boolean display(Map<? extends Element, ?> section) {
+        return section != null && !section.isEmpty();
     }
 
     /**
@@ -207,56 +433,328 @@
     }
 
     /**
-     * Add the summary for the module.
+     * Get table header.
      *
      * @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
+     * @return a content object
      */
-    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);
+    public Content getTableHeader(String text, String tableSummary, HtmlStyle tableStyle,
+            List<String> tableHeader) {
+        return getTableHeader(getTableCaption(new RawHtml(text)), tableSummary, tableStyle, tableHeader);
     }
 
     /**
-     * Add the list of directives for the module.
+     * Get table header.
      *
-     * @param dirs the list of module directives
-     * @param tbody the content tree to which the list is added
+     * @param caption the table caption
+     * @param tableSummary the summary for the table
+     * @param tableStyle the table style
+     * @param tableHeader the table header
+     * @return a content object
      */
-    public void addList(List<ModuleElement.Directive> dirs, Content tbody) {
+    public Content getTableHeader(Content caption, String tableSummary, HtmlStyle tableStyle,
+            List<String> tableHeader) {
+        Content table = (configuration.isOutputHtml5())
+                ? HtmlTree.TABLE(tableStyle, caption)
+                : HtmlTree.TABLE(tableStyle, tableSummary, caption);
+        table.addContent(getSummaryTableHeader(tableHeader, "col"));
+        return table;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addModulesSummary(Content summaryContentTree) {
+        if (display(requires) || display(additionalModules)) {
+            HtmlTree li = new HtmlTree(HtmlTag.LI);
+            li.addStyle(HtmlStyle.blockList);
+            addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
+                    contents.navModules, li);
+            if (display(requires)) {
+            String text = configuration.getText("doclet.Requires_Summary");
+            String tableSummary = configuration.getText("doclet.Member_Table_Summary",
+                    configuration.getText("doclet.Requires_Summary"),
+                    configuration.getText("doclet.modules"));
+                Content table = getTableHeader(text, tableSummary, HtmlStyle.requiresSummary, requiresTableHeader);
+                Content tbody = new HtmlTree(HtmlTag.TBODY);
+                addModulesList(requires, tbody);
+                table.addContent(tbody);
+                li.addContent(table);
+            }
+            // Display additional modules table in both "api" and "all" mode.
+            if (display(additionalModules)) {
+                String amrText = configuration.getText("doclet.Additional_Modules_Required_Summary");
+                String amrTableSummary = configuration.getText("doclet.Member_Table_Summary",
+                        configuration.getText("doclet.Additional_Modules_Required_Summary"),
+                        configuration.getText("doclet.modules"));
+                Content amrTable = getTableHeader(amrText, amrTableSummary, HtmlStyle.requiresSummary, requiresTableHeader);
+                Content amrTbody = new HtmlTree(HtmlTag.TBODY);
+                addModulesList(additionalModules, amrTbody);
+                amrTable.addContent(amrTbody);
+                li.addContent(amrTable);
+            }
+            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
+            summaryContentTree.addContent(ul);
+        }
+    }
+
+    /**
+     * Add the list of modules.
+     *
+     * @param mdleMap map of modules and modifiers
+     * @param tbody the content tree to which the list will be added
+     */
+    public void addModulesList(Map<ModuleElement, Content> mdleMap, 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 OPENS:
-                    //XXX ignore for now
-                    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);
+        for (ModuleElement m : mdleMap.keySet()) {
+            Content tdModifiers = HtmlTree.TD(HtmlStyle.colFirst, mdleMap.get(m));
+            Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName()));
+            Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colSecond, moduleLinkContent);
+            HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+            tdSummary.addStyle(HtmlStyle.colLast);
+            addSummaryComment(m, tdSummary);
+            HtmlTree tr = HtmlTree.TR(tdModifiers);
+            tr.addContent(thModule);
+            tr.addContent(tdSummary);
+            tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+            tbody.addContent(tr);
+            altColor = !altColor;
+        }
+    }
+
+    public void addPackagesSummary(Content summaryContentTree) {
+        if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)
+                || display(additionalPackages) || display(additionalOpenPackages)) {
+            HtmlTree li = new HtmlTree(HtmlTag.LI);
+            li.addStyle(HtmlStyle.blockList);
+            addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
+                    contents.navPackages, li);
+            String tableSummary = configuration.getText("doclet.Member_Table_Summary",
+                    configuration.getText("doclet.Packages_Summary"),
+                    configuration.getText("doclet.packages"));
+            if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)) {
+                addPackageSummary(tableSummary, li);
             }
+            if (display(additionalPackages)) {
+                String aepText = configuration.getText("doclet.Additional_Exported_Packages_Summary");
+                String aepTableSummary = configuration.getText("doclet.Additional_Packages_Table_Summary",
+                        configuration.getText("doclet.Additional_Exported_Packages_Summary"),
+                        configuration.getText("doclet.modules"),
+                        configuration.getText("doclet.packages"));
+                Content aepTable = getTableHeader(aepText, aepTableSummary, HtmlStyle.packagesSummary,
+                        additionalPackagesTableHeader);
+                Content aepTbody = new HtmlTree(HtmlTag.TBODY);
+                addAdditionalPackages(aepTbody, additionalPackages);
+                aepTable.addContent(aepTbody);
+                li.addContent(aepTable);
+            }
+            if (display(additionalOpenPackages)) {
+                String aopText = configuration.getText("doclet.Additional_Opened_Packages_Summary");
+                String aopTableSummary = configuration.getText("doclet.Additional_Packages_Table_Summary",
+                        configuration.getText("doclet.Additional_Opened_Packages_Summary"),
+                        configuration.getText("doclet.modules"),
+                        configuration.getText("doclet.packages"));
+                Content aopTable = getTableHeader(aopText, aopTableSummary, HtmlStyle.packagesSummary,
+                        additionalPackagesTableHeader);
+                Content aopTbody = new HtmlTree(HtmlTag.TBODY);
+                addAdditionalPackages(aopTbody, additionalOpenPackages);
+                aopTable.addContent(aopTbody);
+                li.addContent(aopTable);
+            }
+            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
+            summaryContentTree.addContent(ul);
+        }
+    }
+
+    /**
+     * Add the package summary for the module.
+     *
+     * @param tableSummary
+     * @param li
+     */
+    public void addPackageSummary(String tableSummary, HtmlTree li) {
+        Content caption;
+        Content tbody = getPackageTableRows();
+        if (showTabs()) {
+            caption = getTableCaption();
+            generateTableTabTypesScript(typeMap, modulePackageTypes, "packages");
+        } else {
+            ModulePackageTypes type = modulePackageTypes.iterator().next();
+            caption = getTableCaption(configuration.getContent(type.tableTabs().resourceKey()));
+        }
+        Content table = getTableHeader(caption, tableSummary, HtmlStyle.packagesSummary, exportedPackagesTableHeader);
+        table.addContent(tbody);
+        li.addContent(table);
+    }
+
+    /**
+     * Returns true if the table tabs needs to be displayed.
+     *
+     * @return true if the tabs should be displayed
+     */
+    public boolean showTabs() {
+        int value;
+        for (ModulePackageTypes type : EnumSet.allOf(ModulePackageTypes.class)) {
+            value = type.tableTabs().value();
+            if ((value & packageTypesOr) == value) {
+                modulePackageTypes.add(type);
+            }
+        }
+        boolean showTabs = modulePackageTypes.size() > 1;
+        if (showTabs) {
+            modulePackageTypes.add(ModulePackageTypes.ALL);
+        }
+        return showTabs;
+    }
+
+    /**
+     * Get the summary table caption.
+     *
+     * @return the caption for the summary table
+     */
+    public Content getTableCaption() {
+        Content tabbedCaption = new HtmlTree(HtmlTag.CAPTION);
+        for (ModulePackageTypes type : modulePackageTypes) {
+            Content captionSpan;
+            Content span;
+            if (type.tableTabs().isDefaultTab()) {
+                captionSpan = HtmlTree.SPAN(configuration.getContent(type.tableTabs().resourceKey()));
+                span = HtmlTree.SPAN(type.tableTabs().tabId(),
+                        HtmlStyle.activeTableTab, captionSpan);
+            } else {
+                captionSpan = HtmlTree.SPAN(getPackageTypeLinks(type));
+                span = HtmlTree.SPAN(type.tableTabs().tabId(),
+                        HtmlStyle.tableTab, captionSpan);
+            }
+            Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, Contents.SPACE);
+            span.addContent(tabSpan);
+            tabbedCaption.addContent(span);
+        }
+        return tabbedCaption;
+    }
+
+    /**
+     * Get the package type links for the table caption.
+     *
+     * @param packageType the package type to be displayed as link
+     * @return the content tree for the package type link
+     */
+    public Content getPackageTypeLinks(ModulePackageTypes packageType) {
+        String jsShow = "javascript:showPkgs(" + packageType.tableTabs().value() + ");";
+        HtmlTree link = HtmlTree.A(jsShow, configuration.getContent(packageType.tableTabs().resourceKey()));
+        return link;
+    }
+
+    /**
+     * Get the package table rows.
+     *
+     * @return a content object
+     */
+    public Content getPackageTableRows() {
+        Content tbody = new HtmlTree(HtmlTag.TBODY);
+        boolean altColor = true;
+        int counter = 0;
+        counter = addPackageTableRows(tbody, counter, ModulePackageTypes.EXPORTED, exportedPackages);
+        counter = addPackageTableRows(tbody, counter, ModulePackageTypes.OPENED, openedPackages);
+        // Show concealed packages only in "all" mode.
+        if (moduleMode == ModuleMode.ALL) {
+            for (PackageElement pkg : concealedPackages) {
+                Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
+                Content thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, pkgLinkContent);
+                HtmlTree tdModules = new HtmlTree(HtmlTag.TD);
+                tdModules.addStyle(HtmlStyle.colSecond);
+                tdModules.addContent(configuration.getText("doclet.None"));
+        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+        tdSummary.addStyle(HtmlStyle.colLast);
+                addSummaryComment(pkg, tdSummary);
+        HtmlTree tr = HtmlTree.TR(thPackage);
+                tr.addContent(tdModules);
+        tr.addContent(tdSummary);
+        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+                int pkgType = ModulePackageTypes.CONCEALED.tableTabs().value();
+                packageTypesOr = packageTypesOr | pkgType;
+                String tableId = "i" + counter;
+                counter++;
+                typeMap.put(tableId, pkgType);
+                tr.addAttr(HtmlAttr.ID, tableId);
+        tbody.addContent(tr);
+                altColor = !altColor;
+            }
+        }
+        return tbody;
+    }
+
+    public int addPackageTableRows(Content tbody, int counter, ModulePackageTypes pType,
+            Map<PackageElement,SortedSet<ModuleElement>> ap) {
+        boolean altColor = true;
+        for (Map.Entry<PackageElement, SortedSet<ModuleElement>> entry : ap.entrySet()) {
+            PackageElement pkg = entry.getKey();
+            SortedSet<ModuleElement> mdleList = entry.getValue();
+            Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
+            Content thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, pkgLinkContent);
+            HtmlTree tr = HtmlTree.TR(thPackage);
+            if (moduleMode == ModuleMode.ALL) {
+                HtmlTree tdModules = new HtmlTree(HtmlTag.TD);
+                tdModules.addStyle(HtmlStyle.colSecond);
+                if (!mdleList.isEmpty()) {
+                    int sep = 0;
+                    for (ModuleElement m : mdleList) {
+                        if (sep > 0) {
+                            tdModules.addContent(new HtmlTree(HtmlTag.BR));
+                        }
+                        tdModules.addContent(getModuleLink(m, new StringContent(m.getQualifiedName())));
+                        sep++;
+                    }
+                } else {
+                    tdModules.addContent(configuration.getText("doclet.All_Modules"));
+                }
+                tr.addContent(tdModules);
+            }
+            HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+            tdSummary.addStyle(HtmlStyle.colLast);
+            addSummaryComment(pkg, tdSummary);
+            tr.addContent(tdSummary);
+            tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+            int pkgType = pType.tableTabs().value();
+            packageTypesOr = packageTypesOr | pkgType;
+            String tableId = "i" + counter;
+            counter++;
+            typeMap.put(tableId, pkgType);
+            tr.addAttr(HtmlAttr.ID, tableId);
+            tbody.addContent(tr);
+            altColor = !altColor;
+        }
+        return counter;
+    }
+
+    /**
+     * Add the additional packages for the module being documented.
+     *
+     * @param tbody the content tree to which the table will be added
+     * @param ap additional packages to be added
+     */
+    public void addAdditionalPackages(Content tbody, Map<ModuleElement, SortedSet<PackageElement>> ap) {
+        boolean altColor = true;
+        for (Map.Entry<ModuleElement, SortedSet<PackageElement>> entry : ap.entrySet()) {
+            ModuleElement m = entry.getKey();
+            SortedSet<PackageElement> pkgList = entry.getValue();
+            Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName()));
+            Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent);
+            HtmlTree tdPackages = new HtmlTree(HtmlTag.TD);
+            tdPackages.addStyle(HtmlStyle.colLast);
+            String sep = "";
+            for (PackageElement pkg : pkgList) {
+                tdPackages.addContent(sep);
+                tdPackages.addContent(getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))));
+                sep = " ";
+            }
+            HtmlTree tr = HtmlTree.TR(thModule);
+            tr.addContent(tdPackages);
+            tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+            tbody.addContent(tr);
             altColor = !altColor;
         }
     }
@@ -264,154 +762,39 @@
     /**
      * {@inheritDoc}
      */
-    @Override
-    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,
-                    contents.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 thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent);
-        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
-        tdSummary.addStyle(HtmlStyle.colLast);
-        addSummaryComment(m, tdSummary);
-        HtmlTree tr = HtmlTree.TR(thPackage);
-        tr.addContent(tdSummary);
-        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
-        tbody.addContent(tr);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    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,
-                    contents.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.TH_ROW_SCOPE(HtmlStyle.colFirst, pkgLinkContent);
-        HtmlTree thModules = new HtmlTree(HtmlTag.TD);
-        thModules.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) {
-                    thModules.addContent(new HtmlTree(HtmlTag.BR));
-                }
-                ModuleElement m = mElements.get(i);
-                thModules.addContent(new StringContent(m.getQualifiedName().toString()));
-            }
-        } else {
-            thModules.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(thModules);
-        tr.addContent(tdSummary);
-        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
-        tbody.addContent(tr);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
     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())) {
+        if (display(uses) || display(provides)) {
             HtmlTree li = new HtmlTree(HtmlTag.LI);
             li.addStyle(HtmlStyle.blockList);
             addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
                     contents.navServices, li);
             String text;
             String tableSummary;
-            if (usesDirs != null && !usesDirs.isEmpty()) {
+            if (display(uses)) {
                 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);
+                Content table = getTableHeader(text, tableSummary, HtmlStyle.usesSummary, usesTableHeader);
+                Content tbody = new HtmlTree(HtmlTag.TBODY);
+                addUsesList(tbody);
+                if (!tbody.isEmpty()) {
+                    table.addContent(tbody);
+                    li.addContent(table);
             }
-            if (providesDirs != null && !providesDirs.isEmpty()) {
+            }
+            if (display(provides)) {
                 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);
+                Content table = getTableHeader(text, tableSummary, HtmlStyle.providesSummary, providesTableHeader);
+                Content tbody = new HtmlTree(HtmlTag.TBODY);
+                addProvidesList(tbody);
+                if (!tbody.isEmpty()) {
+                    table.addContent(tbody);
+                    li.addContent(table);
+                }
             }
             HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
             summaryContentTree.addContent(ul);
@@ -419,79 +802,94 @@
     }
 
     /**
-     * Add the uses summary for the module.
+     * Add the uses list 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
+     * @param tbody the content tree to which the directive will be added
      */
-    public void addUsesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
-            Content htmltree) {
-        addSummary(text, tableSummary, htmltree, HtmlStyle.usesSummary, usesTableHeader, dirs);
+    public void addUsesList(Content tbody) {
+        boolean altColor = true;
+        Content typeLinkContent;
+        Content thType;
+        HtmlTree tdSummary;
+        Content description;
+        for (TypeElement t : uses) {
+            // For each uses directive in the module declaration, if we are in the "api" mode and
+            // if there are service types listed using @uses javadoc tag, check if the service type in
+            // the uses directive is specified using the @uses tag. If not, we do not display the
+            // service type in the "api" mode.
+            if (moduleMode == ModuleMode.API && display(usesTrees) && !usesTrees.containsKey(t)) {
+                continue;
+            }
+            typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, t));
+            thType = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, typeLinkContent);
+            tdSummary = new HtmlTree(HtmlTag.TD);
+        tdSummary.addStyle(HtmlStyle.colLast);
+            if (display(usesTrees)) {
+                description = usesTrees.get(t);
+                if (description != null) {
+                    tdSummary.addContent(description);
+                }
+            }
+            addSummaryComment(t, tdSummary);
+            HtmlTree tr = HtmlTree.TR(thType);
+        tr.addContent(tdSummary);
+        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+        tbody.addContent(tr);
+            altColor = !altColor;
+        }
     }
 
     /**
-     * Add the uses list for the module.
+     * Add the provides 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 thPackage = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, typeLinkContent);
-        HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
-        tdSummary.addStyle(HtmlStyle.colLast);
-        addSummaryComment(type, tdSummary);
-        HtmlTree tr = HtmlTree.TR(thPackage);
-        tr.addContent(tdSummary);
-        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
-        tbody.addContent(tr);
+    public void addProvidesList(Content tbody) {
+        boolean altColor = true;
+        TypeElement srv;
+        SortedSet<TypeElement> implSet;
+        Content description;
+        for (Map.Entry<TypeElement, SortedSet<TypeElement>> entry : provides.entrySet()) {
+            srv = entry.getKey();
+            // For each provides directive in the module declaration, if we are in the "api" mode and
+            // if there are service types listed using @provides javadoc tag, check if the service type in
+            // the provides directive is specified using the @provides tag. If not, we do not display the
+            // service type in the "api" mode.
+            if (moduleMode == ModuleMode.API && display(providesTrees) && !providesTrees.containsKey(srv)) {
+                continue;
     }
-
-    /**
-     * 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) {
-        List<? extends TypeElement> impls = direct.getImplementations();
-        for (TypeElement impl : impls) {
-            TypeElement srv = direct.getService();
-            Content implLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl));
+            implSet = entry.getValue();
             Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv));
             HtmlTree thType = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, srvLinkContent);
-            thType.addContent(new HtmlTree(HtmlTag.BR));
-            thType.addContent("(");
-            HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
-            thType.addContent(implSpan);
-            thType.addContent(Contents.SPACE);
-            thType.addContent(implLinkContent);
-            thType.addContent(")");
             HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
             tdDesc.addStyle(HtmlStyle.colLast);
+            if (display(providesTrees)) {
+                description = providesTrees.get(srv);
+                if (description != null) {
+                    tdDesc.addContent(description);
+                }
+            }
             addSummaryComment(srv, tdDesc);
+            // Only display the implementation details in the "all" mode.
+            if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) {
+                tdDesc.addContent(new HtmlTree(HtmlTag.BR));
+                tdDesc.addContent("(");
+                HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
+                tdDesc.addContent(implSpan);
+                tdDesc.addContent(Contents.SPACE);
+                String sep = "";
+                for (TypeElement impl : implSet) {
+                    tdDesc.addContent(sep);
+                    tdDesc.addContent(getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl)));
+                    sep = ", ";
+                }
+                tdDesc.addContent(")");
+            }
             HtmlTree tr = HtmlTree.TR(thType);
             tr.addContent(tdDesc);
             tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
             tbody.addContent(tr);
+            altColor = !altColor;
         }
     }
 
@@ -574,15 +972,17 @@
                 ? getHyperLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription)
                 : contents.navModuleDescription);
         addNavGap(liNav);
-        liNav.addContent(showDirectives(DirectiveKind.REQUIRES)
+        liNav.addContent((display(requires) || display(additionalModules))
                 ? getHyperLink(SectionName.MODULES, contents.navModules)
                 : contents.navModules);
         addNavGap(liNav);
-        liNav.addContent(showDirectives(DirectiveKind.EXPORTS)
+        liNav.addContent((display(exportedPackages) || display(openedPackages) || display(concealedPackages)
+                || display(additionalPackages) || display(additionalOpenPackages))
                 ? getHyperLink(SectionName.PACKAGES, contents.navPackages)
                 : contents.navPackages);
         addNavGap(liNav);
-        liNav.addContent((showDirectives(DirectiveKind.USES) || showDirectives(DirectiveKind.PROVIDES))
+        liNav.addContent((display(uses) || (moduleMode == ModuleMode.API && display(usesTrees))
+                || display(provides) || (moduleMode == ModuleMode.API && display(providesTrees)))
                 ? getHyperLink(SectionName.SERVICES, contents.navServices)
                 : contents.navServices);
         ulNav.addContent(liNav);
@@ -590,16 +990,6 @@
     }
 
     /**
-     * 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();
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
@@ -629,6 +1019,8 @@
 
     /**
      * {@inheritDoc}
+     *
+     * @throws jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException
      */
     @Override
     public void printDocument(Content contentTree) throws DocFileIOException {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java	Fri Dec 16 09:07:57 2016 -0800
@@ -97,7 +97,7 @@
         Content caption;
         if (showTabs) {
             caption = getTableCaption(mw.methodTypes);
-            generateMethodTypesScript(mw.typeMap, mw.methodTypes);
+            generateTableTabTypesScript(mw.typeMap, mw.methodTypes, "methods");
         }
         else {
             caption = getTableCaption(mw.getCaption());
@@ -123,13 +123,13 @@
         for (MethodTypes type : methodTypes) {
             Content captionSpan;
             Content span;
-            if (type.isDefaultTab()) {
-                captionSpan = HtmlTree.SPAN(configuration.getContent(type.resourceKey()));
-                span = HtmlTree.SPAN(type.tabId(),
+            if (type.tableTabs().isDefaultTab()) {
+                captionSpan = HtmlTree.SPAN(configuration.getContent(type.tableTabs().resourceKey()));
+                span = HtmlTree.SPAN(type.tableTabs().tabId(),
                         HtmlStyle.activeTableTab, captionSpan);
             } else {
                 captionSpan = HtmlTree.SPAN(getMethodTypeLinks(type));
-                span = HtmlTree.SPAN(type.tabId(),
+                span = HtmlTree.SPAN(type.tableTabs().tabId(),
                         HtmlStyle.tableTab, captionSpan);
             }
             Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, Contents.SPACE);
@@ -146,8 +146,8 @@
      * @return the content tree for the method type link
      */
     public Content getMethodTypeLinks(MethodTypes methodType) {
-        String jsShow = "javascript:show(" + methodType.value() +");";
-        HtmlTree link = HtmlTree.A(jsShow, configuration.getContent(methodType.resourceKey()));
+        String jsShow = "javascript:show(" + methodType.tableTabs().value() +");";
+        HtmlTree link = HtmlTree.A(jsShow, configuration.getContent(methodType.tableTabs().resourceKey()));
         return link;
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Fri Dec 16 09:07:57 2016 -0800
@@ -28,6 +28,7 @@
 import java.io.*;
 import java.util.*;
 
+import jdk.javadoc.doclet.DocletEnvironment.ModuleMode;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.Resources;
@@ -35,7 +36,8 @@
 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
-import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
+import jdk.javadoc.internal.doclets.toolkit.util.ModulePackageTypes;
+import jdk.javadoc.internal.doclets.toolkit.util.TableTabTypes;
 
 
 /**
@@ -64,32 +66,37 @@
     protected Configuration configuration;
 
     /**
-     * Header for table displaying modules and description..
+     * Header for table displaying modules and description.
      */
     protected final List<String> moduleTableHeader;
 
     /**
-     * Header for tables displaying packages and description..
+     * Header for tables displaying packages and description.
      */
     protected final List<String> packageTableHeader;
 
     /**
-     * Header for tables displaying modules and description..
+     * Header for tables displaying modules and description.
      */
     protected final List<String> requiresTableHeader;
 
     /**
-     * Header for tables displaying packages and description..
+     * Header for tables displaying packages and description.
      */
     protected final List<String> exportedPackagesTableHeader;
 
     /**
-     * Header for tables displaying types and description..
+     * Header for tables displaying modules and exported packages.
+     */
+    protected final List<String> additionalPackagesTableHeader;
+
+    /**
+     * Header for tables displaying types and description.
      */
     protected final List<String> usesTableHeader;
 
     /**
-     * Header for tables displaying types and description..
+     * Header for tables displaying types and description.
      */
     protected final List<String> providesTableHeader;
 
@@ -129,12 +136,18 @@
         packageTableHeader.add(resources.getText("doclet.Package"));
         packageTableHeader.add(resources.getText("doclet.Description"));
         requiresTableHeader = new ArrayList<>();
+        requiresTableHeader.add(resources.getText("doclet.Modifier"));
         requiresTableHeader.add(resources.getText("doclet.Module"));
         requiresTableHeader.add(resources.getText("doclet.Description"));
         exportedPackagesTableHeader = new ArrayList<>();
         exportedPackagesTableHeader.add(resources.getText("doclet.Package"));
+        if (configuration.docEnv.getModuleMode() == ModuleMode.ALL) {
         exportedPackagesTableHeader.add(resources.getText("doclet.Module"));
+        }
         exportedPackagesTableHeader.add(resources.getText("doclet.Description"));
+        additionalPackagesTableHeader = new ArrayList<>();
+        additionalPackagesTableHeader.add(resources.getText("doclet.Module"));
+        additionalPackagesTableHeader.add(resources.getText("doclet.Packages"));
         usesTableHeader = new ArrayList<>();
         usesTableHeader.add(resources.getText("doclet.Type"));
         usesTableHeader.add(resources.getText("doclet.Description"));
@@ -317,12 +330,15 @@
      * Generated javascript variables for the document.
      *
      * @param typeMap map comprising of method and type relationship
-     * @param methodTypes set comprising of all methods types for this class
+     * @param tabTypes set comprising of all table tab types for this class
+     * @param elementName packages or methods table for which tabs need to be displayed
      */
-    public void generateMethodTypesScript(Map<String,Integer> typeMap,
-            Set<MethodTypes> methodTypes) {
+    public void generateTableTabTypesScript(Map<String,Integer> typeMap,
+            Set<? extends TableTabTypes> tabTypes, String elementName) {
         String sep = "";
-        StringBuilder vars = new StringBuilder("var methods = {");
+        StringBuilder vars = new StringBuilder("var ");
+        vars.append(elementName)
+                .append(" = {");
         for (Map.Entry<String,Integer> entry : typeMap.entrySet()) {
             vars.append(sep);
             sep = ",";
@@ -334,18 +350,18 @@
         vars.append("};").append(DocletConstants.NL);
         sep = "";
         vars.append("var tabs = {");
-        for (MethodTypes entry : methodTypes) {
+        for (TableTabTypes entry : tabTypes) {
             vars.append(sep);
             sep = ",";
-            vars.append(entry.value())
+            vars.append(entry.tableTabs().value())
                     .append(":")
                     .append("[")
                     .append("\"")
-                    .append(entry.tabId())
+                    .append(entry.tableTabs().tabId())
                     .append("\"")
                     .append(sep)
                     .append("\"")
-                    .append(configuration.getText(entry.resourceKey()))
+                    .append(configuration.getText(entry.tableTabs().resourceKey()))
                     .append("\"]");
         }
         vars.append("};")
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Fri Dec 16 09:07:57 2016 -0800
@@ -8,6 +8,7 @@
 doclet.Module=Module
 doclet.All_Packages=All Packages
 doclet.All_Modules=All Modules
+doclet.None=None
 doclet.Tree=Tree
 doclet.Class_Hierarchy=Class Hierarchy
 doclet.Window_Class_Hierarchy=Class Hierarchy
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Fri Dec 16 09:07:57 2016 -0800
@@ -82,7 +82,13 @@
 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.Additional_Modules_Required_Summary=Additional Modules Required
+doclet.Additional_Exported_Packages_Summary=Additional Exported Packages
+doclet.Additional_Opened_Packages_Summary=Additional Opened Packages
 doclet.Exported_Packages_Summary=Exported Packages
+doclet.Opened_Packages_Summary=Opened Packages
+doclet.Concealed_Packages_Summary=Concealed Packages
+doclet.Packages_Summary=Packages
 doclet.Uses_Summary=Uses
 doclet.Provides_Summary=Provides
 doclet.Module_Summary=Module Summary
@@ -161,6 +167,7 @@
 doclet.Use_Table_Summary=Use table, listing {0}, and an explanation
 doclet.Constants_Table_Summary={0} table, listing constant fields, and values
 doclet.Member_Table_Summary={0} table, listing {1}, and an explanation
+doclet.Additional_Packages_Table_Summary={0} table, listing {1}, and {2}
 doclet.fields=fields
 doclet.Fields=Fields
 doclet.properties=properties
@@ -188,7 +195,7 @@
 doclet.subinterfaces=subinterfaces
 doclet.Modifier=Modifier
 doclet.Type=Type
-doclet.Implementation=Implementation:
+doclet.Implementation=Implementation(s):
 doclet.Types=Types
 doclet.Members=Members
 doclet.SearchTags=SearchTags
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/script.js	Fri Dec 16 09:07:57 2016 -0800
@@ -91,7 +91,7 @@
     count = 0;
     for (var key in methods) {
         var row = document.getElementById(key);
-        if ((methods[key] &  type) != 0) {
+        if ((methods[key] &  type) !== 0) {
             row.style.display = '';
             row.className = (count++ % 2) ? rowColor : altColor;
         }
@@ -101,6 +101,21 @@
     updateTabs(type);
 }
 
+function showPkgs(type)
+{
+    count = 0;
+    for (var key in packages) {
+        var row = document.getElementById(key);
+        if ((packages[key] &  type) !== 0) {
+            row.style.display = '';
+            row.className = (count++ % 2) ? rowColor : altColor;
+        }
+        else
+            row.style.display = 'none';
+    }
+    updatePkgsTabs(type);
+}
+
 function updateTabs(type)
 {
     for (var value in tabs) {
@@ -122,3 +137,19 @@
     top.packageFrame.location = pFrame;
     top.classFrame.location = cFrame;
 }
+
+function updatePkgsTabs(type)
+{
+    for (var value in tabs) {
+        var sNode = document.getElementById(tabs[value][0]);
+        var spanNode = sNode.firstChild;
+        if (value == type) {
+            sNode.className = activeTableTab;
+            spanNode.innerHTML = tabs[value][1];
+        }
+        else {
+            sNode.className = tableTab;
+            spanNode.innerHTML = "<a href=\"javascript:showPkgs(" + value + ");\">" + tabs[value][1] + "</a>";
+        }
+    }
+}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Fri Dec 16 09:07:57 2016 -0800
@@ -472,7 +472,7 @@
     border: none;
     height:16px;
 }
-.memberSummary caption span.activeTableTab span {
+.memberSummary caption span.activeTableTab span, .packagesSummary caption span.activeTableTab span {
     white-space:nowrap;
     padding-top:5px;
     padding-left:12px;
@@ -483,7 +483,7 @@
     background-color:#F8981D;
     height:16px;
 }
-.memberSummary caption span.tableTab span {
+.memberSummary caption span.tableTab span, .packagesSummary caption span.tableTab span {
     white-space:nowrap;
     padding-top:5px;
     padding-left:12px;
@@ -494,7 +494,8 @@
     background-color:#4D7A97;
     height:16px;
 }
-.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {
+.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab,
+.packagesSummary caption span.tableTab, .packagesSummary caption span.activeTableTab {
     padding-top:0px;
     padding-left:0px;
     padding-right:0px;
@@ -511,7 +512,7 @@
     float:left;
     background-color:#F8981D;
 }
-.memberSummary .activeTableTab .tabEnd {
+.memberSummary .activeTableTab .tabEnd, .packagesSummary .activeTableTab .tabEnd {
     display:none;
     width:5px;
     margin-right:3px;
@@ -519,7 +520,7 @@
     float:left;
     background-color:#F8981D;
 }
-.memberSummary .tableTab .tabEnd {
+.memberSummary .tableTab .tabEnd, .packagesSummary .tableTab .tabEnd {
     display:none;
     width:5px;
     margin-right:3px;
@@ -562,21 +563,28 @@
 .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,
+.providesSummary td.colFirst, .providesSummary th.colFirst,
 .memberSummary td.colFirst, .memberSummary th.colFirst,
 .memberSummary td.colSecond, .memberSummary th.colSecond,
 .typeSummary td.colFirst{
-    width:25%;
     vertical-align:top;
 }
-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, th.colFirst a:link, th.colFirst a:active, th.colFirst a:visited, th.colFirst a:hover, th.colSecond a:link, th.colSecond a:active, th.colSecond a:visited, th.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 {
+.packagesSummary th.colLast, .packagesSummary td.colLast {
+    white-space:normal;
+}
+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,
+th.colFirst a:link, th.colFirst a:active, th.colFirst a:visited, th.colFirst a:hover,
+th.colSecond a:link, th.colSecond a:active, th.colSecond a:visited, th.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 {
@@ -776,4 +784,4 @@
 .searchTagHolderResult {
     font-style:italic;
     font-size:12px;
-}
\ No newline at end of file
+}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java	Fri Dec 16 09:07:57 2016 -0800
@@ -50,6 +50,7 @@
 import com.sun.source.doctree.LinkTree;
 import com.sun.source.doctree.LiteralTree;
 import com.sun.source.doctree.ParamTree;
+import com.sun.source.doctree.ProvidesTree;
 import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.doctree.ReturnTree;
 import com.sun.source.doctree.SeeTree;
@@ -61,6 +62,7 @@
 import com.sun.source.doctree.TextTree;
 import com.sun.source.doctree.ThrowsTree;
 import com.sun.source.doctree.UnknownBlockTagTree;
+import com.sun.source.doctree.UsesTree;
 import com.sun.source.doctree.ValueTree;
 import com.sun.source.doctree.VersionTree;
 import com.sun.source.util.DocTreePath;
@@ -107,12 +109,14 @@
             case AUTHOR:
             case DEPRECATED:
             case PARAM:
+            case PROVIDES:
             case RETURN:
             case SEE:
             case SERIAL_DATA:
             case SERIAL_FIELD:
             case THROWS:
             case UNKNOWN_BLOCK_TAG:
+            case USES:
             case VERSION:
                 return ((BlockTagTree)dtree).getTagName();
             case UNKNOWN_INLINE_TAG:
@@ -441,6 +445,11 @@
             }
 
             @Override
+            public Element visitProvides(ProvidesTree node, Void p) {
+                return visit(node.getServiceType(), null);
+            }
+
+            @Override
             public Element visitValue(ValueTree node, Void p) {
                 return visit(node.getReference(), null);
             }
@@ -456,12 +465,25 @@
             }
 
             @Override
+            public Element visitUses(UsesTree node, Void p) {
+                return visit(node.getServiceType(), null);
+            }
+
+            @Override
             protected Element defaultAction(DocTree node, Void p) {
                return null;
             }
         }.visit(dtree, null);
     }
 
+    public TypeElement getServiceType(Configuration c, DocTree dtree) {
+        Element e = getReferencedElement(c, dtree);
+        if (e != null) {
+            return c.utils.isTypeElement(e) ? (TypeElement) e : null;
+        }
+        return null;
+    }
+
     public  String getReferencedSignature(DocTree dtree) {
         return new SimpleDocTreeVisitor<String, Void>() {
             @Override
@@ -554,6 +576,11 @@
             }
 
             @Override
+            public List<? extends DocTree> visitProvides(ProvidesTree node, Void p) {
+                 return node.getDescription();
+            }
+
+            @Override
             public List<? extends DocTree> visitSince(SinceTree node, Void p) {
                 return node.getBody();
             }
@@ -609,6 +636,11 @@
             }
 
             @Override
+            public List<? extends DocTree> visitUses(UsesTree node, Void p) {
+                 return node.getDescription();
+            }
+
+            @Override
             protected List<? extends DocTree> defaultAction(DocTree node, Void p) {
                return Collections.emptyList();
             }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MethodTypes.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MethodTypes.java	Fri Dec 16 09:07:57 2016 -0800
@@ -30,40 +30,23 @@
  *
  * @author Bhavesh Patel
  */
-public enum MethodTypes {
-    ALL(0xffff, "doclet.All_Methods", "t0", true),
-    STATIC(0x1, "doclet.Static_Methods", "t1", false),
-    INSTANCE(0x2, "doclet.Instance_Methods", "t2", false),
-    ABSTRACT(0x4, "doclet.Abstract_Methods", "t3", false),
-    CONCRETE(0x8, "doclet.Concrete_Methods", "t4", false),
-    DEFAULT(0x10, "doclet.Default_Methods", "t5", false),
-    DEPRECATED(0x20, "doclet.Deprecated_Methods", "t6", false);
+public enum MethodTypes implements TableTabTypes {
 
-    private final int value;
-    private final String resourceKey;
-    private final String tabId;
-    private final boolean isDefaultTab;
+    ALL(TableTabs.tab(0xffff, "doclet.All_Methods", "t0", true)),
+    STATIC(TableTabs.tab(0x1, "doclet.Static_Methods", "t1", false)),
+    INSTANCE(TableTabs.tab(0x2, "doclet.Instance_Methods", "t2", false)),
+    ABSTRACT(TableTabs.tab(0x4, "doclet.Abstract_Methods", "t3", false)),
+    CONCRETE(TableTabs.tab(0x8, "doclet.Concrete_Methods", "t4", false)),
+    DEFAULT(TableTabs.tab(0x10, "doclet.Default_Methods", "t5", false)),
+    DEPRECATED(TableTabs.tab(0x20, "doclet.Deprecated_Methods", "t6", false));
 
-    MethodTypes(int v, String k, String id, boolean dt) {
-        this.value = v;
-        this.resourceKey = k;
-        this.tabId = id;
-        this.isDefaultTab = dt;
+    private final TableTabs tabs;
+
+    private MethodTypes(TableTabs t) {
+        this.tabs = t;
     }
 
-    public int value() {
-        return value;
+    public TableTabs tableTabs() {
+        return this.tabs;
     }
-
-    public String resourceKey() {
-        return resourceKey;
     }
-
-    public String tabId() {
-        return tabId;
-    }
-
-    public boolean isDefaultTab() {
-        return isDefaultTab;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ModulePackageTypes.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,55 @@
+/*
+ * 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 jdk.javadoc.internal.doclets.toolkit.util;
+
+import jdk.javadoc.internal.doclets.toolkit.util.TableTabTypes.TableTabs;
+
+/**
+ * Enum representing module package types.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public enum ModulePackageTypes implements TableTabTypes {
+    ALL(TableTabs.tab(0xffff, "doclet.All_Packages", "t0", true)),
+    EXPORTED(TableTabs.tab(0x1, "doclet.Exported_Packages_Summary", "t1", false)),
+    OPENED(TableTabs.tab(0x2, "doclet.Opened_Packages_Summary", "t2", false)),
+    CONCEALED(TableTabs.tab(0x4, "doclet.Concealed_Packages_Summary", "t3", false));
+
+    private final TableTabs tabs;
+
+    private ModulePackageTypes(TableTabs t) {
+        this.tabs = t;
+    }
+
+    public TableTabs tableTabs() {
+        return this.tabs;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/TableTabTypes.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,76 @@
+/*
+ * 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 jdk.javadoc.internal.doclets.toolkit.util;
+
+/**
+ * Interface representing table tab types.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public interface TableTabTypes {
+
+    TableTabs tableTabs();
+
+    public static final class TableTabs {
+
+        private final int value;
+        private final String resourceKey;
+        private final String tabId;
+        private final boolean isDefaultTab;
+
+        private TableTabs(int v, String k, String id, boolean dt) {
+            this.value = v;
+            this.resourceKey = k;
+            this.tabId = id;
+            this.isDefaultTab = dt;
+        }
+
+        public static TableTabs tab(int value, String resourceKey, String tabId, boolean isDefaultTab) {
+            return new TableTabs(value, resourceKey, tabId, isDefaultTab);
+        }
+
+        public int value() {
+            return this.value;
+        }
+
+        public String resourceKey() {
+            return this.resourceKey;
+        }
+
+        public String tabId() {
+            return this.tabId;
+        }
+
+        public boolean isDefaultTab() {
+            return this.isDefaultTab;
+        }
+    }
+}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Fri Dec 16 09:07:57 2016 -0800
@@ -42,6 +42,7 @@
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.Modifier;
 import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.ModuleElement.RequiresDirective;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.TypeParameterElement;
@@ -1678,7 +1679,7 @@
         return new Utils.ElementComparator<Element>() {
             @Override
             public int compare(Element mod1, Element mod2) {
-                return compareFullyQualifiedNames(mod1, mod2);
+                return compareNames(mod1, mod2);
             }
         };
     }
@@ -2193,6 +2194,64 @@
         return member.getEnclosingElement().getEnclosedElements().indexOf(member);
     }
 
+    private Map<ModuleElement, Set<PackageElement>> modulePackageMap = null;
+    public Map<ModuleElement, Set<PackageElement>> getModulePackageMap() {
+        if (modulePackageMap == null) {
+            modulePackageMap = new HashMap<>();
+            Set<PackageElement> pkgs = configuration.getIncludedPackageElements();
+            pkgs.forEach((pkg) -> {
+                ModuleElement mod = elementUtils.getModuleOf(pkg);
+                modulePackageMap.computeIfAbsent(mod, m -> new HashSet<>()).add(pkg);
+            });
+        }
+        return modulePackageMap;
+    }
+
+    public Map<ModuleElement, String> getDependentModules(ModuleElement mdle) {
+        Map<ModuleElement, String> result = new TreeMap<>(makeModuleComparator());
+        Deque<ModuleElement> queue = new ArrayDeque<>();
+        // get all the requires for the element in question
+        for (RequiresDirective rd : ElementFilter.requiresIn(mdle.getDirectives())) {
+            ModuleElement dep = rd.getDependency();
+            // add the dependency to work queue
+            if (!result.containsKey(dep)) {
+                if (rd.isTransitive()) {
+                    queue.addLast(dep);
+                }
+            }
+            // add all exports for the primary module
+            result.put(rd.getDependency(), getModifiers(rd));
+        }
+
+        // add only requires public for subsequent module dependencies
+        for (ModuleElement m = queue.poll(); m != null; m = queue.poll()) {
+            for (RequiresDirective rd : ElementFilter.requiresIn(m.getDirectives())) {
+                ModuleElement dep = rd.getDependency();
+                if (!result.containsKey(dep)) {
+                    if (rd.isTransitive()) {
+                        result.put(dep, getModifiers(rd));
+                        queue.addLast(dep);
+                    }
+                }
+            }
+        }
+        return result;
+    }
+
+    public String getModifiers(RequiresDirective rd) {
+        StringBuilder modifiers = new StringBuilder();
+        String sep="";
+        if (rd.isTransitive()) {
+            modifiers.append("transitive");
+            sep = " ";
+        }
+        if (rd.isStatic()) {
+            modifiers.append(sep);
+            modifiers.append("static");
+        }
+        return (modifiers.length() == 0) ? " " : modifiers.toString();
+    }
+
     public long getLineNumber(Element e) {
         TreePath path = getTreePath(e);
         if (path == null) { // maybe null if synthesized
@@ -3019,6 +3078,10 @@
         return getBlockTags(element, DEPRECATED);
     }
 
+    public List<? extends DocTree> getProvidesTrees(Element element) {
+        return getBlockTags(element, PROVIDES);
+    }
+
     public List<? extends DocTree> getSeeTrees(Element element) {
         return getBlockTags(element, SEE);
     }
@@ -3062,6 +3125,10 @@
         return out;
     }
 
+    public List<? extends DocTree> getUsesTrees(Element element) {
+        return getBlockTags(element, USES);
+    }
+
     public List<? extends DocTree> getFirstSentenceTrees(Element element) {
         DocCommentTree dcTree = getDocCommentTree(element);
         if (dcTree == null) {
--- a/test/jdk/javadoc/doclet/testModules/TestModules.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/test/jdk/javadoc/doclet/testModules/TestModules.java	Fri Dec 16 09:07:57 2016 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674
+ * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674 8160196
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -45,7 +45,7 @@
     void testHtml4() {
         javadoc("-d", "out", "-use",
                 "--module-source-path", testSrc,
-                "--add-modules", "moduleA,moduleB",
+                "--module", "moduleA,moduleB",
                 "testpkgmdlA", "testpkgmdlB");
         checkExit(Exit.OK);
         checkDescription(true);
@@ -66,7 +66,7 @@
     void testHtml5() {
         javadoc("-d", "out-html5", "-html5", "-use",
                 "--module-source-path", testSrc,
-                "--add-modules", "moduleA,moduleB",
+                "--module", "moduleA,moduleB",
                 "testpkgmdlA", "testpkgmdlB");
         checkExit(Exit.OK);
         checkHtml5Description(true);
@@ -87,7 +87,7 @@
     void testHtml4NoComment() {
         javadoc("-d", "out-nocomment", "-nocomment", "-use",
                 "--module-source-path", testSrc,
-                "--add-modules", "moduleA,moduleB",
+                "--module", "moduleA,moduleB",
                 "testpkgmdlA", "testpkgmdlB");
         checkExit(Exit.OK);
         checkDescription(false);
@@ -104,7 +104,7 @@
     void testHtml5NoComment() {
         javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use",
                 "--module-source-path", testSrc,
-                "--add-modules", "moduleA,moduleB",
+                "--module", "moduleA,moduleB",
                 "testpkgmdlA", "testpkgmdlB");
         checkExit(Exit.OK);
         checkHtml5Description(false);
@@ -154,7 +154,7 @@
                 "-tag", "regular:a:Regular Tag:",
                 "-tag", "moduletag:s:Module Tag:",
                 "--module-source-path", testSrc,
-                "--add-modules", "moduletags,moduleB",
+                "--module", "moduletags,moduleB",
                 "testpkgmdltags", "testpkgmdlB");
         checkExit(Exit.OK);
         checkModuleTags();
@@ -167,7 +167,7 @@
     void testModuleSummary() {
         javadoc("-d", "out-moduleSummary", "-use",
                 "--module-source-path", testSrc,
-                "--add-modules", "moduleA,moduleB",
+                "--module", "moduleA,moduleB",
                 "testpkgmdlA", "testpkgmdlB", "moduleB/testpkg2mdlB");
         checkExit(Exit.OK);
         checkModuleSummary();
@@ -181,7 +181,7 @@
     void testModuleFilesAndLinks() {
         javadoc("-d", "out-modulelinks",
                 "--module-source-path", testSrc,
-                "--add-modules", "moduleA",
+                "--module", "moduleA",
                 "testpkgmdlA");
         checkExit(Exit.OK);
         checkModuleFilesAndLinks(true);
@@ -216,6 +216,40 @@
         checkModuleAnnotation();
     }
 
+    /**
+     * Test module summary pages in "api" mode.
+     */
+    @Test
+    void testApiMode() {
+        javadoc("-d", "out-api", "-use", "--show-module-contents=api", "-author", "-version",
+                "-tag", "regular:a:Regular Tag:",
+                "-tag", "moduletag:s:Module Tag:",
+                "--module-source-path", testSrc,
+                "--module", "moduleA,moduleB,moduleC,moduletags",
+                "testpkgmdlA", "moduleA/concealedpkgmdlA", "testpkgmdlB", "testpkg2mdlB", "testpkgmdlC", "testpkgmdltags");
+        checkExit(Exit.OK);
+        checkModuleModeCommon();
+        checkModuleModeApi(true);
+        checkModuleModeAll(false);
+    }
+
+    /**
+     * Test module summary pages in "all" mode.
+     */
+    @Test
+    void testAllMode() {
+        javadoc("-d", "out-all", "-use", "--show-module-contents=all", "-author", "-version",
+                "-tag", "regular:a:Regular Tag:",
+                "-tag", "moduletag:s:Module Tag:",
+                "--module-source-path", testSrc,
+                "--module", "moduleA,moduleB,moduleC,moduletags",
+                "testpkgmdlA", "moduleA/concealedpkgmdlA", "testpkgmdlB", "testpkg2mdlB", "testpkgmdlC", "testpkgmdltags");
+        checkExit(Exit.OK);
+        checkModuleModeCommon();
+        checkModuleModeApi(false);
+        checkModuleModeAll(true);
+    }
+
     void checkDescription(boolean found) {
         checkOutput("moduleA-summary.html", found,
                 "<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -247,7 +281,7 @@
                 + "<li class=\"blockList\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
-                + "<!-- ============ MODULES SUMMARY =========== -->");
+                + "<!-- ============ PACKAGES SUMMARY =========== -->");
     }
 
     void checkHtml5Description(boolean found) {
@@ -287,7 +321,7 @@
                 + "<li class=\"blockList\">\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
-                + "<!-- ============ MODULES SUMMARY =========== -->");
+                + "<!-- ============ PACKAGES SUMMARY =========== -->");
     }
 
     void checkModuleLink() {
@@ -322,30 +356,22 @@
     void checkModuleTags() {
         checkOutput("moduletags-summary.html", true,
                 "Type Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html\" title=\"class in "
-                + "testpkgmdltags\"><code>TestClassInModuleTags</code></a>.");
-        checkOutput("moduletags-summary.html", true,
+                + "testpkgmdltags\"><code>TestClassInModuleTags</code></a>.",
                 "Member Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html#"
-                + "testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.");
-        checkOutput("moduletags-summary.html", true,
-                "Package Link: <a href=\"testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.");
-        checkOutput("moduletags-summary.html", true,
+                + "testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.",
+                "Package Link: <a href=\"testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.",
                 "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
-                + "<dd>JDK 9</dd>");
-        checkOutput("moduletags-summary.html", true,
+                + "<dd>JDK 9</dd>",
                 "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
                 + "<dd>\"Test see tag\", \n"
                 + "<a href=\"testpkgmdltags/TestClassInModuleTags.html\" title=\"class in testpkgmdltags\"><code>"
-                + "TestClassInModuleTags</code></a></dd>");
-        checkOutput("moduletags-summary.html", true,
+                + "TestClassInModuleTags</code></a></dd>",
                 "<dt><span class=\"simpleTagLabel\">Regular Tag:</span></dt>\n"
-                + "<dd>Just a regular simple tag.</dd>");
-        checkOutput("moduletags-summary.html", true,
+                + "<dd>Just a regular simple tag.</dd>",
                 "<dt><span class=\"simpleTagLabel\">Module Tag:</span></dt>\n"
-                + "<dd>Just a simple module tag.</dd>");
-        checkOutput("moduletags-summary.html", true,
+                + "<dd>Just a simple module tag.</dd>",
                 "<dt><span class=\"simpleTagLabel\">Version:</span></dt>\n"
-                + "<dd>1.0</dd>");
-        checkOutput("moduletags-summary.html", true,
+                + "<dd>1.0</dd>",
                 "<dt><span class=\"simpleTagLabel\">Author:</span></dt>\n"
                 + "<dd>Bhavesh Patel</dd>");
         checkOutput("testpkgmdltags/TestClassInModuleTags.html", false,
@@ -428,96 +454,64 @@
                 + "<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("moduleA-summary.html", true,
+                + "</ul>",
                 "<!-- ============ MODULES SUMMARY =========== -->\n"
                 + "<a name=\"modules.summary\">\n"
                 + "<!--   -->\n"
-                + "</a>");
-        checkOutput("moduleA-summary.html", true,
-                "<tr class=\"altColor\">\n"
+                + "</a>",
+                "<tr class=\"altColor\" id=\"i0\">\n"
                 + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlA/package-summary.html\">testpkgmdlA</a></th>\n"
-                + "<td class=\"colSecond\">All Modules</td>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
-                + "</tr>");
-        checkOutput("moduleA-summary.html", true,
+                + "</tr>",
                 "<!-- ============ PACKAGES SUMMARY =========== -->\n"
                 + "<a name=\"packages.summary\">\n"
                 + "<!--   -->\n"
-                + "</a>");
-        checkOutput("moduleA-summary.html", true,
-                "<tr class=\"rowColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "</a>",
+                "<tr class=\"altColor\">\n"
+                + "<td class=\"colFirst\">transitive</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
                 + "<td class=\"colLast\">\n"
                 + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
                 + "</td>\n"
                 + "</tr>");
         checkOutput("moduleB-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("moduleB-summary.html", true,
-                "<!-- ============ MODULES SUMMARY =========== -->\n"
-                + "<a name=\"modules.summary\">\n"
-                + "<!--   -->\n"
-                + "</a>");
-        checkOutput("moduleB-summary.html", true,
-                "<tr class=\"rowColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/package-summary.html\">"
-                + "testpkg2mdlB</a></th>\n"
-                + "<td class=\"colSecond\">moduleA</td>\n"
-                + "<td class=\"colLast\">&nbsp;</td>\n"
-                + "</tr>");
-        checkOutput("moduleB-summary.html", true,
+                "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;Modules&nbsp;|&nbsp;"
+                + "<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">"
+                + "Services</a></li>",
                 "<!-- ============ PACKAGES SUMMARY =========== -->\n"
                 + "<a name=\"packages.summary\">\n"
                 + "<!--   -->\n"
-                + "</a>");
-        checkOutput("moduleB-summary.html", true,
-                "<tr class=\"altColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"java.base-summary.html\">java.base</a></th>\n"
+                + "</a>",
+                "<tr class=\"altColor\" id=\"i0\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
-                + "</tr>");
-        checkOutput("moduleB-summary.html", true,
+                + "</tr>",
+                "<!-- ============ PACKAGES SUMMARY =========== -->\n"
+                + "<a name=\"packages.summary\">\n"
+                + "<!--   -->\n"
+                + "</a>",
                 "<!-- ============ SERVICES SUMMARY =========== -->\n"
                 + "<a name=\"services.summary\">\n"
                 + "<!--   -->\n"
-                + "</a>");
-        checkOutput("moduleB-summary.html", true,
+                + "</a>",
                 "<tr class=\"altColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClassInModuleB.html\" "
-                + "title=\"class in testpkgmdlB\">TestClassInModuleB</a></th>\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClassInModuleB.html\" title=\"class in testpkgmdlB\">TestClassInModuleB</a></th>\n"
+                + "<td class=\"colLast\">With a test description for uses.&nbsp;</td>\n"
+                + "</tr>",
+                "<tr class=\"altColor\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/TestInterface2InModuleB.html\" title=\"interface in testpkg2mdlB\">TestInterface2InModuleB</a></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>\n"
-                + "</tr>");
-        checkOutput("moduleB-summary.html", true,
-                "<tr class=\"altColor\">\n"
-                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/TestInterfaceInModuleB.html\" "
-                + "title=\"interface in testpkg2mdlB\">TestInterfaceInModuleB</a><br>"
-                + "(<span class=\"implementationLabel\">Implementation:</span>&nbsp;"
-                + "<a href=\"testpkgmdlB/TestClassInModuleB.html\" title=\"class in testpkgmdlB\">"
-                + "TestClassInModuleB</a>)</th>\n"
-                + "<td class=\"colLast\">&nbsp;</td>\n"
-                + "</tr");
-        checkOutput("moduleB-summary.html", true,
-                "<caption><span>Exported Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "</tr>",
+                "<caption><span>Opened Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                 + "<tr>\n"
                 + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
-                + "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
-                + "</tr>");
-        checkOutput("moduleB-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("moduleB-summary.html", true,
+                + "</tr>",
                 "<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("moduleB-summary.html", true,
+                + "</tr>",
                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                 + "<tr>\n"
                 + "<th class=\"colFirst\" scope=\"col\">Type</th>\n"
@@ -537,8 +531,7 @@
         checkOutput("module-overview-frame.html", true,
                 "<li><a href=\"moduleA-frame.html\" target=\"packageListFrame\" "
                 + "onclick=\"updateModuleFrame('moduleA-type-frame.html','moduleA-summary.html');"
-                + "\">moduleA</a></li>");
-        checkOutput("module-overview-frame.html", true,
+                + "\">moduleA</a></li>",
                 "<li><a href=\"moduleB-frame.html\" target=\"packageListFrame\" "
                 + "onclick=\"updateModuleFrame('moduleB-type-frame.html','moduleB-summary.html');"
                 + "\">moduleB</a></li>");
@@ -558,13 +551,11 @@
 
     void checkModuleFilesAndLinks(boolean found) {
         checkOutput("testpkgmdlA/package-summary.html", found,
-                "<li><a href=\"../moduleA-summary.html\">Module</a></li>");
-        checkOutput("testpkgmdlA/package-summary.html", found,
+                "<li><a href=\"../moduleA-summary.html\">Module</a></li>",
                 "<div class=\"subTitle\"><span class=\"moduleLabelInClass\">Module</span>&nbsp;"
                 + "<a href=\"../moduleA-summary.html\">moduleA</a></div>");
         checkOutput("testpkgmdlA/TestClassInModuleA.html", found,
-                "<li><a href=\"../moduleA-summary.html\">Module</a></li>");
-        checkOutput("testpkgmdlA/TestClassInModuleA.html", found,
+                "<li><a href=\"../moduleA-summary.html\">Module</a></li>",
                 "<div class=\"subTitle\"><span class=\"moduleLabelInClass\">Module</span>&nbsp;"
                 + "<a href=\"../moduleA-summary.html\">moduleA</a></div>");
         checkFiles(found,
@@ -584,8 +575,7 @@
                 + "<dd>\n"
                 + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
                 + "</dd>\n"
-                + "</dl>");
-        checkOutput("index-all.html", found,
+                + "</dl>",
                 "<dl>\n"
                 + "<dt><span class=\"searchTagLink\"><a href=\"moduleA-summary.html#searchphrase\">"
                 + "search phrase</a></span> - Search tag in moduleA</dt>\n"
@@ -596,6 +586,175 @@
                 + "</dl>");
 }
 
+    void checkModuleModeCommon() {
+        checkOutput("overview-summary.html", true,
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleA-summary.html\">moduleA</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleA module.</div>\n"
+                + "</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
+                + "</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"moduletags-summary.html\">moduletags</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleA module.<br>\n"
+                + " Type Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html\" title=\"class in testpkgmdltags\"><code>TestClassInModuleTags</code></a>.<br>\n"
+                + " Member Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html#testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.<br>\n"
+                + " Package Link: <a href=\"testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.<br></div>\n"
+                + "</td>");
+        checkOutput("moduleA-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;Services</li>",
+                "<td class=\"colFirst\">transitive</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
+                + "</td>",
+                "<table class=\"packagesSummary\" summary=\"Additional Exported Packages table, listing modules, and packages\">\n"
+                + "<caption><span>Additional Exported Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>",
+                "<table class=\"packagesSummary\" summary=\"Additional Opened Packages table, listing modules, and packages\">\n"
+                + "<caption><span>Additional Opened Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
+                + "</tr>\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n"
+                + "</tr>\n"
+                + "</tbody>\n"
+                + "</table>");
+        checkOutput("moduleB-summary.html", true,
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClassInModuleB.html\" title=\"class in testpkgmdlB\">TestClassInModuleB</a></th>\n"
+                + "<td class=\"colLast\">With a test description for uses.&nbsp;</td>");
+        checkOutput("moduletags-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;Services</li>",
+                "<table class=\"requiresSummary\" summary=\"Additional Modules Required table, listing modules, and an explanation\">\n"
+                + "<caption><span>Additional Modules Required</span><span class=\"tabEnd\">&nbsp;</span></caption>",
+                "<td class=\"colFirst\">transitive</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
+                + "</td>",
+                "<table class=\"packagesSummary\" summary=\"Additional Exported Packages table, listing modules, and packages\">\n"
+                + "<caption><span>Additional Exported Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>",
+                "<td class=\"colFirst\">transitive static</td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleA-summary.html\">moduleA</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleA module.</div>\n"
+                + "</td>",
+                "<table class=\"requiresSummary\" summary=\"Requires table, listing modules, and an explanation\">\n"
+                + "<caption><span>Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Modifier</th>\n"
+                + "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
+                "<table class=\"requiresSummary\" summary=\"Additional Modules Required table, listing modules, and an explanation\">\n"
+                + "<caption><span>Additional Modules Required</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Modifier</th>\n"
+                + "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
+                "<table class=\"packagesSummary\" summary=\"Additional Opened Packages table, listing modules, and packages\">\n"
+                + "<caption><span>Additional Opened Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
+                + "</tr>\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+                + "<td class=\"colLast\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n"
+                + "</tr>\n"
+                + "</tbody>\n"
+                + "</table>");
+    }
+
+    void checkModuleModeApi(boolean found) {
+        checkOutput("moduleA-summary.html", found,
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlA/package-summary.html\">testpkgmdlA</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>");
+        checkOutput("moduleB-summary.html", found,
+                "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;Modules&nbsp;|&nbsp;"
+                + "<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">Services</a></li>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<table class=\"packagesSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
+                + "<caption><span>Opened Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>\n"
+                + "<tbody>\n"
+                + "<tr class=\"altColor\" id=\"i0\">\n"
+                + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>\n"
+                + "</tr>\n"
+                + "</tbody>\n"
+                + "</table>");
+        checkOutput("moduletags-summary.html", found,
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdltags/package-summary.html\">testpkgmdltags</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>");
+    }
+
+    void checkModuleModeAll(boolean found) {
+        checkOutput("moduleA-summary.html", found,
+                "<td class=\"colFirst\"> </td>\n"
+                + "<th class=\"colSecond\" scope=\"row\">java.base</th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<td class=\"colFirst\"> </td>\n"
+                + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleC-summary.html\">moduleC</a></th>\n"
+                + "<td class=\"colLast\">\n"
+                + "<div class=\"block\">This is a test description for the moduleC module.</div>\n"
+                + "</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"moduleC-summary.html\">moduleC</a></th>\n"
+                + "<td class=\"colLast\"><a href=\"testpkgmdlC/package-summary.html\">testpkgmdlC</a></td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlA/package-summary.html\">testpkgmdlA</a></th>\n"
+                + "<td class=\"colSecond\">All Modules</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\">&nbsp;</span></span>"
+                + "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:showPkgs(1);\">Exported Packages</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:showPkgs(4);\">"
+                + "Concealed Packages</a></span><span class=\"tabEnd\">&nbsp;</span></span></caption>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"concealedpkgmdlA/package-summary.html\">concealedpkgmdlA</a></th>\n"
+                + "<td class=\"colSecond\">None</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>");
+        checkOutput("moduleB-summary.html", found,
+                "<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>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
+                + "<td class=\"colSecond\">All Modules</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<td class=\"colFirst\"> </td>\n"
+                + "<th class=\"colSecond\" scope=\"row\">java.base</th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClass2InModuleB.html\" title=\"class in testpkgmdlB\">TestClass2InModuleB</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/TestInterface2InModuleB.html\" title=\"interface in testpkg2mdlB\">TestInterface2InModuleB</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;<br>(<span class=\"implementationLabel\">Implementation(s):</span>&nbsp;<a href=\"testpkgmdlB/TestClass2InModuleB.html\" "
+                + "title=\"class in testpkgmdlB\">TestClass2InModuleB</a>)</td>",
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/TestInterfaceInModuleB.html\" title=\"interface in testpkg2mdlB\">TestInterfaceInModuleB</a></th>\n"
+                + "<td class=\"colLast\">&nbsp;<br>(<span class=\"implementationLabel\">Implementation(s):</span>&nbsp;<a href=\"testpkgmdlB/TestClassInModuleB.html\" "
+                + "title=\"class in testpkgmdlB\">TestClassInModuleB</a>)</td>",
+                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t1\" class=\"tableTab\"><span>"
+                + "<a href=\"javascript:showPkgs(1);\">Exported Packages</a></span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t2\" class=\"tableTab\"><span>"
+                + "<a href=\"javascript:showPkgs(2);\">Opened Packages</a></span><span class=\"tabEnd\">&nbsp;</span></span></caption>");
+        checkOutput("moduleC-summary.html", found,
+                "<caption><span>Exported Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+                + "<tr>\n"
+                + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+                + "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+                + "</tr>");
+        checkOutput("moduletags-summary.html", found,
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdltags/package-summary.html\">testpkgmdltags</a></th>\n"
+                + "<td class=\"colSecond\">All Modules</td>\n"
+                + "<td class=\"colLast\">&nbsp;</td>");
+    }
+
     void checkModuleDeprecation(boolean found) {
         checkOutput("moduleA-summary.html", found,
                 "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testModules/moduleA/concealedpkgmdlA/ConcealedClassInModuleA.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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 concealedpkgmdlA;
+
+public class ConcealedClassInModuleA {
+    public void testMethodConcealedClass() { }
+}
--- a/test/jdk/javadoc/doclet/testModules/moduleA/module-info.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/test/jdk/javadoc/doclet/testModules/moduleA/module-info.java	Fri Dec 16 09:07:57 2016 -0800
@@ -30,7 +30,8 @@
   */
 @Deprecated(forRemoval=true)
 module moduleA {
-    requires moduleB;
+    requires transitive moduleB;
+    requires moduleC;
 
     exports testpkgmdlA;
 }
--- a/test/jdk/javadoc/doclet/testModules/moduleB/module-info.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/test/jdk/javadoc/doclet/testModules/moduleB/module-info.java	Fri Dec 16 09:07:57 2016 -0800
@@ -26,16 +26,20 @@
 /**
   * This is a test description for the moduleB module. Search word {@index search_word} with no description.
   *
+  * @uses testpkgmdlB.TestClassInModuleB With a test description for uses.
+  * @provides testpkg2mdlB.TestInterface2InModuleB
   * @deprecated This module is deprecated using just the javadoc tag.
   */
 @testpkgmdlB.AnnotationType(optional="Module Annotation", required=2016)
 @testpkgmdlB.AnnotationTypeUndocumented(optional="Module Annotation", required=2016)
 module moduleB {
-    exports testpkgmdlB;
+    opens testpkgmdlB;
 
     exports testpkg2mdlB to moduleA;
 
     uses testpkgmdlB.TestClassInModuleB;
+    uses testpkgmdlB.TestClass2InModuleB;
 
     provides testpkg2mdlB.TestInterfaceInModuleB with testpkgmdlB.TestClassInModuleB;
+    provides testpkg2mdlB.TestInterface2InModuleB with testpkgmdlB.TestClass2InModuleB;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testModules/moduleB/testpkg2mdlB/TestInterface2InModuleB.java	Fri Dec 16 09:07:57 2016 -0800
@@ -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 testpkg2mdlB;
+
+public interface TestInterface2InModuleB {
+    void testMethod2();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testModules/moduleB/testpkgmdlB/TestClass2InModuleB.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,31 @@
+/*
+ * 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 testpkgmdlB;
+
+import testpkg2mdlB.TestInterface2InModuleB;
+
+public class TestClass2InModuleB implements TestInterface2InModuleB {
+    void testMethod2() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testModules/moduleC/module-info.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+/**
+  * This is a test description for the moduleC module.
+  */
+module moduleC {
+
+    exports testpkgmdlC to moduleA;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javadoc/doclet/testModules/moduleC/testpkgmdlC/TestClassInModuleC.java	Fri Dec 16 09:07:57 2016 -0800
@@ -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 testpkgmdlC;
+
+public class TestClassInModuleC {
+    public void testMethodClassModuleC() { }
+}
--- a/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java	Fri Dec 16 09:07:57 2016 -0800
@@ -39,7 +39,7 @@
   */
 @Deprecated
 module moduletags {
-    requires moduleB;
+    requires transitive static moduleA;
 
     exports testpkgmdltags;
 }
--- a/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Fri Dec 16 09:07:57 2016 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363
+ * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196
  * @summary  Run tests on doclet stylesheet.
  * @author   jamieh
  * @library  ../lib
@@ -111,7 +111,7 @@
                 + "    border: none;\n"
                 + "    height:16px;\n"
                 + "}",
-                ".memberSummary caption span.activeTableTab span {\n"
+                ".memberSummary caption span.activeTableTab span, .packagesSummary caption span.activeTableTab span {\n"
                 + "    white-space:nowrap;\n"
                 + "    padding-top:5px;\n"
                 + "    padding-left:12px;\n"
@@ -122,7 +122,7 @@
                 + "    background-color:#F8981D;\n"
                 + "    height:16px;\n"
                 + "}",
-                ".memberSummary caption span.tableTab span {\n"
+                ".memberSummary caption span.tableTab span, .packagesSummary caption span.tableTab span {\n"
                 + "    white-space:nowrap;\n"
                 + "    padding-top:5px;\n"
                 + "    padding-left:12px;\n"
@@ -138,11 +138,10 @@
                 + ".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"
+                + ".providesSummary td.colFirst, .providesSummary th.colFirst,\n"
                 + ".memberSummary td.colFirst, .memberSummary th.colFirst,\n"
                 + ".memberSummary td.colSecond, .memberSummary th.colSecond,\n"
                 + ".typeSummary td.colFirst{\n"
-                + "    width:25%;\n"
                 + "    vertical-align:top;\n"
                 + "}",
                 ".overviewSummary td, .memberSummary td, .typeSummary td,\n"
@@ -151,7 +150,8 @@
                 + "    text-align:left;\n"
                 + "    padding:0px 0px 12px 10px;\n"
                 + "}",
-                ".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {\n"
+                ".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab,\n"
+                + ".packagesSummary caption span.tableTab, .packagesSummary caption span.activeTableTab {\n"
                 + "    padding-top:0px;\n"
                 + "    padding-left:0px;\n"
                 + "    padding-right:0px;\n"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/ProvidesTest.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,29 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8160196
+ * @summary Module summary page should display information based on "api" or "detail" mode.
+ * @modules jdk.compiler/com.sun.tools.doclint
+ * @build DocLintTester
+ * @run main DocLintTester -ref ProvidesTest.out ProvidesTest.java
+ */
+
+/**
+ * Invalid use of provides in class documentation.
+ *
+ * @provides UsesTest
+ */
+public class ProvidesTest {
+    /**
+     * Invalid use of provides in field documentation
+     *
+     * @provides UsesTest Test description.
+     */
+    public int invalid_param;
+
+    /**
+     * Invalid use of provides in method documentation
+     *
+     * @provides UsesTest Test description.
+     */
+    public class InvalidParam { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/ProvidesTest.out	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,28 @@
+ProvidesTest.java:13: error: invalid use of @provides
+ * @provides UsesTest
+   ^
+ProvidesTest.java:13: error: service-type not found
+ * @provides UsesTest
+   ^
+ProvidesTest.java:13: error: reference not found
+ * @provides UsesTest
+             ^
+ProvidesTest.java:19: error: invalid use of @provides
+     * @provides UsesTest Test description.
+       ^
+ProvidesTest.java:19: error: service-type not found
+     * @provides UsesTest Test description.
+       ^
+ProvidesTest.java:19: error: reference not found
+     * @provides UsesTest Test description.
+                 ^
+ProvidesTest.java:26: error: invalid use of @provides
+     * @provides UsesTest Test description.
+       ^
+ProvidesTest.java:26: error: service-type not found
+     * @provides UsesTest Test description.
+       ^
+ProvidesTest.java:26: error: reference not found
+     * @provides UsesTest Test description.
+                 ^
+9 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/UsesTest.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,29 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8160196
+ * @summary Module summary page should display information based on "api" or "detail" mode.
+ * @modules jdk.compiler/com.sun.tools.doclint
+ * @build DocLintTester
+ * @run main DocLintTester -ref UsesTest.out UsesTest.java
+ */
+
+/**
+ * Invalid use of uses in class documentation.
+ *
+ * @uses ProvidesTest
+ */
+public class UsesTest {
+    /**
+     * Invalid use of uses in field documentation
+     *
+     * @uses ProvidesTest Test description.
+     */
+    public int invalid_param;
+
+    /**
+     * Invalid use of uses in method documentation
+     *
+     * @uses ProvidesTest Test description.
+     */
+    public class InvalidParam { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/UsesTest.out	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,28 @@
+UsesTest.java:13: error: invalid use of @uses
+ * @uses ProvidesTest
+   ^
+UsesTest.java:13: error: service-type not found
+ * @uses ProvidesTest
+   ^
+UsesTest.java:13: error: reference not found
+ * @uses ProvidesTest
+         ^
+UsesTest.java:19: error: invalid use of @uses
+     * @uses ProvidesTest Test description.
+       ^
+UsesTest.java:19: error: service-type not found
+     * @uses ProvidesTest Test description.
+       ^
+UsesTest.java:19: error: reference not found
+     * @uses ProvidesTest Test description.
+             ^
+UsesTest.java:26: error: invalid use of @uses
+     * @uses ProvidesTest Test description.
+       ^
+UsesTest.java:26: error: service-type not found
+     * @uses ProvidesTest Test description.
+       ^
+UsesTest.java:26: error: reference not found
+     * @uses ProvidesTest Test description.
+             ^
+9 errors
--- a/test/tools/javac/doctree/DocCommentTester.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/test/tools/javac/doctree/DocCommentTester.java	Fri Dec 16 09:07:57 2016 -0800
@@ -498,6 +498,17 @@
                 return null;
             }
 
+            public Void visitProvides(ProvidesTree node, Void p) {
+                header(node);
+                indent(+1);
+                print("serviceName", node.getServiceType());
+                print("description", node.getDescription());
+                indent(-1);
+                indent();
+                out.println("]");
+                return null;
+            }
+
             public Void visitReference(ReferenceTree node, Void p) {
                 header(node, compress(node.getSignature()));
                 return null;
@@ -617,6 +628,17 @@
                 return null;
             }
 
+            public Void visitUses(UsesTree node, Void p) {
+                header(node);
+                indent(+1);
+                print("serviceName", node.getServiceType());
+                print("description", node.getDescription());
+                indent(-1);
+                indent();
+                out.println("]");
+                return null;
+            }
+
             public Void visitValue(ValueTree node, Void p) {
                 header(node);
                 indent(+1);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/doctree/ProvidesTest.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8160196
+ * @summary Module summary page should display information based on "api" or "detail" mode.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.tree
+ *          jdk.compiler/com.sun.tools.javac.util
+ * @build DocCommentTester
+ * @run main DocCommentTester ProvidesTest.java
+ */
+
+class ProvidesTest {
+    /**
+     * abc.
+     * @provides UsesTest
+      */
+    void simple_provides() { }
+/*
+DocComment[DOC_COMMENT, pos:1
+  firstSentence: 1
+    Text[TEXT, pos:1, abc.]
+  body: empty
+  block tags: 1
+    Provides[PROVIDES, pos:7
+      serviceName:
+        Reference[REFERENCE, pos:17, UsesTest]
+      description: empty
+    ]
+]
+*/
+
+    /**
+     * abc.
+     * @provides UsesTest Test description for provides.
+      */
+    void provides_with_description() { }
+/*
+DocComment[DOC_COMMENT, pos:1
+  firstSentence: 1
+    Text[TEXT, pos:1, abc.]
+  body: empty
+  block tags: 1
+    Provides[PROVIDES, pos:7
+      serviceName:
+        Reference[REFERENCE, pos:17, UsesTest]
+      description: 1
+        Text[TEXT, pos:26, Test_description_for_provides.]
+    ]
+]
+*/
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/doctree/UsesTest.java	Fri Dec 16 09:07:57 2016 -0800
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8160196
+ * @summary Module summary page should display information based on "api" or "detail" mode.
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.tree
+ *          jdk.compiler/com.sun.tools.javac.util
+ * @build DocCommentTester
+ * @run main DocCommentTester UsesTest.java
+ */
+
+class UsesTest {
+    /**
+     * abc.
+     * @uses ProvidesTest
+      */
+    void simple_uses() { }
+/*
+DocComment[DOC_COMMENT, pos:1
+  firstSentence: 1
+    Text[TEXT, pos:1, abc.]
+  body: empty
+  block tags: 1
+    Uses[USES, pos:7
+      serviceName:
+        Reference[REFERENCE, pos:13, ProvidesTest]
+      description: empty
+    ]
+]
+*/
+
+    /**
+     * abc.
+     * @uses ProvidesTest Test description for uses.
+      */
+    void uses_with_description() { }
+/*
+DocComment[DOC_COMMENT, pos:1
+  firstSentence: 1
+    Text[TEXT, pos:1, abc.]
+  body: empty
+  block tags: 1
+    Uses[USES, pos:7
+      serviceName:
+        Reference[REFERENCE, pos:13, ProvidesTest]
+      description: 1
+        Text[TEXT, pos:26, Test_description_for_uses.]
+    ]
+]
+*/
+}
--- a/test/tools/javac/lib/DPrinter.java	Fri Dec 16 18:54:09 2016 +0300
+++ b/test/tools/javac/lib/DPrinter.java	Fri Dec 16 09:07:57 2016 -0800
@@ -1085,6 +1085,13 @@
             return visitBlockTag(node, null);
         }
 
+        public Void visitProvides(ProvidesTree node, Void p) {
+            printString("kind", node.getKind().name());
+            printDocTree("serviceType", node.getServiceType());
+            printList("description", node.getDescription());
+            return visitBlockTag(node, null);
+        }
+
         public Void visitReference(ReferenceTree node, Void p) {
             printString("signature", node.getSignature());
             return visitTree(node, null);
@@ -1152,6 +1159,13 @@
             return visitInlineTag(node, null);
         }
 
+        public Void visitUses(UsesTree node, Void p) {
+            printString("kind", node.getKind().name());
+            printDocTree("serviceType", node.getServiceType());
+            printList("description", node.getDescription());
+            return visitBlockTag(node, null);
+        }
+
         public Void visitValue(ValueTree node, Void p) {
             printDocTree("value", node.getReference());
             return visitInlineTag(node, null);