8196027: Remove "Prev" and "Next" links from the javadoc navigation
authorbpatel
Tue, 06 Feb 2018 18:28:23 -0800
changeset 48756 ce608a09a666
parent 48755 fe377d6591ef
child 48757 8cc67294ec56
8196027: Remove "Prev" and "Next" links from the javadoc navigation Reviewed-by: jjg, ksrini
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.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/PackageTreeWriter.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactoryImpl.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/WriterFactory.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java
test/langtools/jdk/javadoc/doclet/testIndexFiles/TestIndexFiles.java
test/langtools/jdk/javadoc/doclet/testNavigation/TestModuleNavigation.java
test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue Feb 06 18:28:23 2018 -0800
@@ -37,7 +37,6 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
-import jdk.javadoc.internal.doclets.formats.html.markup.Links;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
 import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -70,23 +69,15 @@
 
     protected TypeElement annotationType;
 
-    protected TypeMirror prev;
-
-    protected TypeMirror next;
-
     /**
      * @param configuration the configuration
      * @param annotationType the annotation type being documented.
-     * @param prevType the previous class that was documented.
-     * @param nextType the next class being documented.
      */
     public AnnotationTypeWriterImpl(HtmlConfiguration configuration,
-            TypeElement annotationType, TypeMirror prevType, TypeMirror nextType) {
+            TypeElement annotationType) {
         super(configuration, DocPath.forClass(configuration.utils, annotationType));
         this.annotationType = annotationType;
         configuration.currentTypeElement = annotationType;
-        this.prev = prevType;
-        this.next = nextType;
     }
 
     /**
@@ -139,44 +130,6 @@
     }
 
     /**
-     * Get link to previous class.
-     *
-     * @return a content tree for the previous class link
-     */
-    @Override
-    public Content getNavLinkPrevious() {
-        Content li;
-        if (prev != null) {
-            Content prevLink = getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CLASS, utils.asTypeElement(prev))
-                    .label(contents.prevClassLabel).strong(true));
-            li = HtmlTree.LI(prevLink);
-        }
-        else
-            li = HtmlTree.LI(contents.prevClassLabel);
-        return li;
-    }
-
-    /**
-     * Get link to next class.
-     *
-     * @return a content tree for the next class link
-     */
-    @Override
-    public Content getNavLinkNext() {
-        Content li;
-        if (next != null) {
-            Content nextLink = getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CLASS, utils.asTypeElement(next))
-                    .label(contents.nextClassLabel).strong(true));
-            li = HtmlTree.LI(nextLink);
-        }
-        else
-            li = HtmlTree.LI(contents.nextClassLabel);
-        return li;
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Tue Feb 06 18:28:23 2018 -0800
@@ -40,7 +40,6 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
-import jdk.javadoc.internal.doclets.formats.html.markup.Links;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
 import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -79,25 +78,17 @@
 
     protected final ClassTree classtree;
 
-    protected final TypeElement prev;
-
-    protected final TypeElement next;
-
     /**
      * @param configuration the configuration data for the doclet
      * @param typeElement the class being documented.
-     * @param prevClass the previous class that was documented.
-     * @param nextClass the next class being documented.
      * @param classTree the class tree for the given class.
      */
     public ClassWriterImpl(HtmlConfiguration configuration, TypeElement typeElement,
-                           TypeElement prevClass, TypeElement nextClass, ClassTree classTree) {
+                           ClassTree classTree) {
         super(configuration, DocPath.forClass(configuration.utils, typeElement));
         this.typeElement = typeElement;
         configuration.currentTypeElement = typeElement;
         this.classtree = classTree;
-        this.prev = prevClass;
-        this.next = nextClass;
     }
 
     /**
@@ -150,44 +141,6 @@
     }
 
     /**
-     * Get link to previous class.
-     *
-     * @return a content tree for the previous class link
-     */
-    @Override
-    public Content getNavLinkPrevious() {
-        Content li;
-        if (prev != null) {
-            Content prevLink = getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CLASS, prev)
-                    .label(contents.prevClassLabel).strong(true));
-            li = HtmlTree.LI(prevLink);
-        }
-        else
-            li = HtmlTree.LI(contents.prevClassLabel);
-        return li;
-    }
-
-    /**
-     * Get link to next class.
-     *
-     * @return a content tree for the next class link
-     */
-    @Override
-    public Content getNavLinkNext() {
-        Content li;
-        if (next != null) {
-            Content nextLink = getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CLASS, next)
-                    .label(contents.nextClassLabel).strong(true));
-            li = HtmlTree.LI(nextLink);
-        }
-        else
-            li = HtmlTree.LI(contents.nextClassLabel);
-        return li;
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java	Tue Feb 06 18:28:23 2018 -0800
@@ -140,11 +140,6 @@
     public final Content navServices;
     public final Content nestedClassSummary;
     public final Content newPage;
-    public final Content nextClassLabel;
-    public final Content nextLabel;
-    public final Content nextLetter;
-    public final Content nextModuleLabel;
-    public final Content nextPackageLabel;
     public final Content noFramesLabel;
     public final Content noScriptMessage;
     public final Content openModuleLabel;
@@ -155,11 +150,6 @@
     public final Content packageLabel;
     public final Content package_;
     public final Content packagesLabel;
-    public final Content prevClassLabel;
-    public final Content prevLabel;
-    public final Content prevLetter;
-    public final Content prevModuleLabel;
-    public final Content prevPackageLabel;
     public final Content properties;
     public final Content propertyLabel;
     public final Content propertyDetailsLabel;
@@ -275,11 +265,6 @@
         navServices = getContent("doclet.navServices");
         nestedClassSummary = getContent("doclet.Nested_Class_Summary");
         newPage = new Comment(resources.getText("doclet.New_Page"));
-        nextClassLabel = getNonBreakContent("doclet.Next_Class");
-        nextLabel = getNonBreakContent("doclet.Next");
-        nextLetter = getContent("doclet.Next_Letter");
-        nextModuleLabel = getNonBreakContent("doclet.Next_Module");
-        nextPackageLabel = getNonBreakContent("doclet.Next_Package");
         noFramesLabel = getNonBreakContent("doclet.No_Frames");
         noScriptMessage = getContent("doclet.No_Script_Message");
         openedTo = getContent("doclet.OpenedTo");
@@ -290,11 +275,6 @@
         packageLabel = getContent("doclet.Package");
         package_ = getContent("doclet.package");
         packagesLabel = getContent("doclet.Packages");
-        prevClassLabel = getNonBreakContent("doclet.Prev_Class");
-        prevLabel = getContent("doclet.Prev");
-        prevLetter = getContent("doclet.Prev_Letter");
-        prevModuleLabel = getNonBreakContent("doclet.Prev_Module");
-        prevPackageLabel = getNonBreakContent("doclet.Prev_Package");
         properties = getContent("doclet.Properties");
         propertyLabel = getContent("doclet.Property");
         propertyDetailsLabel = getContent("doclet.Property_Detail");
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java	Tue Feb 06 18:28:23 2018 -0800
@@ -241,29 +241,19 @@
             throws DocletException {
         List<TypeElement> list = new ArrayList<>(arr);
         ListIterator<TypeElement> iterator = list.listIterator();
-        TypeElement klass = null;
-        while (iterator.hasNext()) {
-            TypeElement prev = iterator.hasPrevious() ? klass : null;
-            klass = iterator.next();
-            TypeElement next = iterator.nextIndex() == list.size()
-                    ? null : list.get(iterator.nextIndex());
-
+        for (TypeElement klass : list) {
             if (utils.isHidden(klass) ||
                     !(configuration.isGeneratedDoc(klass) && utils.isIncluded(klass))) {
                 continue;
             }
-
             if (utils.isAnnotationType(klass)) {
                 AbstractBuilder annotationTypeBuilder =
                     configuration.getBuilderFactory()
-                        .getAnnotationTypeBuilder(klass,
-                            prev == null ? null : prev.asType(),
-                            next == null ? null : next.asType());
+                        .getAnnotationTypeBuilder(klass);
                 annotationTypeBuilder.build();
             } else {
                 AbstractBuilder classBuilder =
-                    configuration.getBuilderFactory().getClassBuilder(klass,
-                            prev, next, classtree);
+                    configuration.getBuilderFactory().getClassBuilder(klass, classtree);
                 classBuilder.build();
             }
         }
@@ -278,7 +268,6 @@
             if (configuration.frames  && configuration.modules.size() > 1) {
                 ModuleIndexFrameWriter.generate(configuration);
             }
-            ModuleElement prevModule = null, nextModule;
             List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet());
             int i = 0;
             for (ModuleElement mdle : mdles) {
@@ -286,12 +275,9 @@
                     ModulePackageIndexFrameWriter.generate(configuration, mdle);
                     ModuleFrameWriter.generate(configuration, mdle);
                 }
-                nextModule = (i + 1 < mdles.size()) ? mdles.get(i + 1) : null;
                 AbstractBuilder moduleSummaryBuilder =
-                        configuration.getBuilderFactory().getModuleSummaryBuilder(
-                        mdle, prevModule, nextModule);
+                        configuration.getBuilderFactory().getModuleSummaryBuilder(mdle);
                 moduleSummaryBuilder.build();
-                prevModule = mdle;
                 i++;
             }
         }
@@ -317,7 +303,6 @@
             PackageIndexFrameWriter.generate(configuration);
         }
         List<PackageElement> pList = new ArrayList<>(packages);
-        PackageElement prev = null;
         for (int i = 0 ; i < pList.size() ; i++) {
             // if -nodeprecated option is set and the package is marked as
             // deprecated, do not generate the package-summary.html, package-frame.html
@@ -327,24 +312,12 @@
                 if (configuration.frames) {
                     PackageFrameWriter.generate(configuration, pkg);
                 }
-                int nexti = i + 1;
-                PackageElement next = null;
-                if (nexti < pList.size()) {
-                    next = pList.get(nexti);
-                    // If the next package is unnamed package, skip 2 ahead if possible
-                    if (next.isUnnamed() && ++nexti < pList.size()) {
-                       next = pList.get(nexti);
-                    }
-                }
                 AbstractBuilder packageSummaryBuilder =
-                        configuration.getBuilderFactory().getPackageSummaryBuilder(
-                        pkg, prev, next);
+                        configuration.getBuilderFactory().getPackageSummaryBuilder(pkg);
                 packageSummaryBuilder.build();
                 if (configuration.createtree) {
-                    PackageTreeWriter.generate(configuration, pkg, prev, next,
-                            configuration.nodeprecated);
+                    PackageTreeWriter.generate(configuration, pkg, configuration.nodeprecated);
                 }
-                prev = pkg;
             }
         }
     }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Tue Feb 06 18:28:23 2018 -0800
@@ -572,8 +572,8 @@
             } else {
                 tree.addContent(navDiv);
             }
-            Content ulNav = HtmlTree.UL(HtmlStyle.navList, getNavLinkPrevious(), getNavLinkNext());
-            Content subDiv = HtmlTree.DIV(HtmlStyle.subNav, ulNav);
+            HtmlTree subDiv = new HtmlTree(HtmlTag.DIV);
+            subDiv.setStyle(HtmlStyle.subNav);
             if (configuration.frames) {
                 Content ulFrames = HtmlTree.UL(HtmlStyle.navList,
                     getNavShowLists(), getNavHideLists(filename));
@@ -620,26 +620,6 @@
     }
 
     /**
-     * Get the word "NEXT" to indicate that no link is available.  Override
-     * this method to customize next link.
-     *
-     * @return a content tree for the link
-     */
-    protected Content getNavLinkNext() {
-        return getNavLinkNext(null);
-    }
-
-    /**
-     * Get the word "PREV" to indicate that no link is available.  Override
-     * this method to customize prev link.
-     *
-     * @return a content tree for the link
-     */
-    protected Content getNavLinkPrevious() {
-        return getNavLinkPrevious(null);
-    }
-
-    /**
      * Do nothing. This is the default method.
      */
     protected void addSummaryDetailLinks(Content navDiv) {
@@ -712,39 +692,6 @@
     }
 
     /**
-     * Get link for previous file.
-     *
-     * @param prev File name for the prev link
-     * @return a content tree for the link
-     */
-    public Content getNavLinkPrevious(DocPath prev) {
-        Content li;
-        if (prev != null) {
-            li = HtmlTree.LI(links.createLink(prev, contents.prevLabel, "", ""));
-        }
-        else
-            li = HtmlTree.LI(contents.prevLabel);
-        return li;
-    }
-
-    /**
-     * Get link for next file.  If next is null, just print the label
-     * without linking it anywhere.
-     *
-     * @param next File name for the next link
-     * @return a content tree for the link
-     */
-    public Content getNavLinkNext(DocPath next) {
-        Content li;
-        if (next != null) {
-            li = HtmlTree.LI(links.createLink(next, contents.nextLabel, "", ""));
-        }
-        else
-            li = HtmlTree.LI(contents.nextLabel);
-        return li;
-    }
-
-    /**
      * Get "FRAMES" link, to switch to the frame version of the output.
      *
      * @param link File to be linked, "index.html"
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Tue Feb 06 18:28:23 2018 -0800
@@ -50,7 +50,6 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
-import jdk.javadoc.internal.doclets.formats.html.markup.Links;
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -74,16 +73,6 @@
 public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryWriter {
 
     /**
-     * The prev module name in the alpha-order list.
-     */
-    protected ModuleElement prevModule;
-
-    /**
-     * The next module name in the alpha-order list.
-     */
-    protected ModuleElement nextModule;
-
-    /**
      * The module being documented.
      */
     protected ModuleElement mdle;
@@ -187,14 +176,9 @@
      *
      * @param configuration the configuration of the doclet.
      * @param mdle        Module under consideration.
-     * @param prevModule   Previous module in the sorted array.
-     * @param nextModule   Next module in the sorted array.
      */
-    public ModuleWriterImpl(HtmlConfiguration configuration,
-            ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule) {
+    public ModuleWriterImpl(HtmlConfiguration configuration, ModuleElement mdle) {
         super(configuration, DocPaths.moduleSummary(mdle));
-        this.prevModule = prevModule;
-        this.nextModule = nextModule;
         this.mdle = mdle;
         this.moduleMode = configuration.docEnv.getModuleMode();
         computeModulesData();
@@ -1044,38 +1028,4 @@
         Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.moduleLabel);
         return li;
     }
-
-    /**
-     * Get "PREV MODULE" link in the navigation bar.
-     *
-     * @return a content tree for the previous link
-     */
-    @Override
-    public Content getNavLinkPrevious() {
-        Content li;
-        if (prevModule == null) {
-            li = HtmlTree.LI(contents.prevModuleLabel);
-        } else {
-            li = HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.moduleSummary(
-                    prevModule)), contents.prevModuleLabel, "", ""));
-        }
-        return li;
-    }
-
-    /**
-     * Get "NEXT MODULE" link in the navigation bar.
-     *
-     * @return a content tree for the next link
-     */
-    @Override
-    public Content getNavLinkNext() {
-        Content li;
-        if (nextModule == null) {
-            li = HtmlTree.LI(contents.nextModuleLabel);
-        } else {
-            li = HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.moduleSummary(
-                    nextModule)), contents.nextModuleLabel, "", ""));
-        }
-        return li;
-    }
 }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java	Tue Feb 06 18:28:23 2018 -0800
@@ -31,7 +31,6 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
-import jdk.javadoc.internal.doclets.formats.html.markup.Links;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
@@ -59,32 +58,15 @@
     protected PackageElement packageElement;
 
     /**
-     * The previous package name in the alpha-order list.
-     */
-    protected PackageElement prev;
-
-    /**
-     * The next package name in the alpha-order list.
-     */
-    protected PackageElement next;
-
-    /**
      * Constructor.
      * @param configuration the configuration
      * @param path the docpath to generate files into
      * @param packageElement the current package
-     * @param prev the previous package
-     * @param next the next package
      */
-    public PackageTreeWriter(HtmlConfiguration configuration,
-                             DocPath path,
-                             PackageElement packageElement,
-                             PackageElement prev, PackageElement next) {
+    public PackageTreeWriter(HtmlConfiguration configuration, DocPath path, PackageElement packageElement) {
         super(configuration, path,
               new ClassTree(configuration.typeElementCatalog.allClasses(packageElement), configuration));
         this.packageElement = packageElement;
-        this.prev = prev;
-        this.next = next;
     }
 
     /**
@@ -93,18 +75,15 @@
      *
      * @param configuration the configuration for this run.
      * @param pkg      Package for which tree file is to be generated.
-     * @param prev     Previous package in the alpha-ordered list.
-     * @param next     Next package in the alpha-ordered list.
      * @param noDeprecated  If true, do not generate any information for
      * deprecated classe or interfaces.
      * @throws DocFileIOException if there is a problem generating the package tree page
      */
     public static void generate(HtmlConfiguration configuration,
-                                PackageElement pkg, PackageElement prev,
-                                PackageElement next, boolean noDeprecated)
+                                PackageElement pkg, boolean noDeprecated)
             throws DocFileIOException {
         DocPath path = DocPath.forPackage(pkg).resolve(DocPaths.PACKAGE_TREE);
-        PackageTreeWriter packgen = new PackageTreeWriter(configuration, path, pkg, prev, next);
+        PackageTreeWriter packgen = new PackageTreeWriter(configuration, path, pkg);
         packgen.generatePackageTreeFile();
     }
 
@@ -183,36 +162,6 @@
     }
 
     /**
-     * Get link for the previous package tree file.
-     *
-     * @return a content tree for the link
-     */
-    @Override
-    protected Content getNavLinkPrevious() {
-        if (prev == null) {
-            return getNavLinkPrevious(null);
-        } else {
-            DocPath path = DocPath.relativePath(packageElement, prev);
-            return getNavLinkPrevious(path.resolve(DocPaths.PACKAGE_TREE));
-        }
-    }
-
-    /**
-     * Get link for the next package tree file.
-     *
-     * @return a content tree for the link
-     */
-    @Override
-    protected Content getNavLinkNext() {
-        if (next == null) {
-            return getNavLinkNext(null);
-        } else {
-            DocPath path = DocPath.relativePath(packageElement, next);
-            return getNavLinkNext(path.resolve(DocPaths.PACKAGE_TREE));
-        }
-    }
-
-    /**
      * Get the module link.
      *
      * @return a content tree for the module link
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Tue Feb 06 18:28:23 2018 -0800
@@ -40,7 +40,6 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
-import jdk.javadoc.internal.doclets.formats.html.markup.Links;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
@@ -66,16 +65,6 @@
     implements PackageSummaryWriter {
 
     /**
-     * The prev package name in the alpha-order list.
-     */
-    protected PackageElement prev;
-
-    /**
-     * The next package name in the alpha-order list.
-     */
-    protected PackageElement next;
-
-    /**
      * The package being documented.
      */
     protected PackageElement packageElement;
@@ -100,16 +89,11 @@
      *
      * @param configuration the configuration of the doclet.
      * @param packageElement    PackageElement under consideration.
-     * @param prev          Previous package in the sorted array.
-     * @param next            Next package in the sorted array.
      */
-    public PackageWriterImpl(HtmlConfiguration configuration,
-            PackageElement packageElement, PackageElement prev, PackageElement next) {
+    public PackageWriterImpl(HtmlConfiguration configuration, PackageElement packageElement) {
         super(configuration, DocPath
                 .forPackage(packageElement)
                 .resolve(DocPaths.PACKAGE_SUMMARY));
-        this.prev = prev;
-        this.next = next;
         this.packageElement = packageElement;
     }
 
@@ -392,42 +376,6 @@
     }
 
     /**
-     * Get "PREV PACKAGE" link in the navigation bar.
-     *
-     * @return a content tree for the previous link
-     */
-    @Override
-    public Content getNavLinkPrevious() {
-        Content li;
-        if (prev == null) {
-            li = HtmlTree.LI(contents.prevPackageLabel);
-        } else {
-            DocPath p = DocPath.relativePath(packageElement, prev);
-            li = HtmlTree.LI(links.createLink(p.resolve(DocPaths.PACKAGE_SUMMARY),
-                contents.prevPackageLabel, "", ""));
-        }
-        return li;
-    }
-
-    /**
-     * Get "NEXT PACKAGE" link in the navigation bar.
-     *
-     * @return a content tree for the next link
-     */
-    @Override
-    public Content getNavLinkNext() {
-        Content li;
-        if (next == null) {
-            li = HtmlTree.LI(contents.nextPackageLabel);
-        } else {
-            DocPath p = DocPath.relativePath(packageElement, next);
-            li = HtmlTree.LI(links.createLink(p.resolve(DocPaths.PACKAGE_SUMMARY),
-                contents.nextPackageLabel, "", ""));
-        }
-        return li;
-    }
-
-    /**
      * Get "Tree" link in the navigation bar. This will be link to the package
      * tree file.
      *
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java	Tue Feb 06 18:28:23 2018 -0800
@@ -35,7 +35,6 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
-import jdk.javadoc.internal.doclets.formats.html.markup.Links;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
@@ -60,16 +59,6 @@
  */
 public class SplitIndexWriter extends AbstractIndexWriter {
 
-    /**
-     * Previous unicode character index in the built index.
-     */
-    protected int prev;
-
-    /**
-     * Next unicode character in the built index.
-     */
-    protected int next;
-
     private final List<Character> indexElements;
 
     /**
@@ -80,18 +69,13 @@
      * @param path       Path to the file which is getting generated.
      * @param indexbuilder Unicode based Index from {@link IndexBuilder}
      * @param elements the collection of characters for which to generate index files
-     * @param prev  the previous character that was indexed
-     * @param next  the next character to be indexed
      */
     public SplitIndexWriter(HtmlConfiguration configuration,
                             DocPath path,
                             IndexBuilder indexbuilder,
-                            Collection<Character> elements,
-                            int prev, int next) {
+                            Collection<Character> elements) {
         super(configuration, path, indexbuilder);
         this.indexElements = new ArrayList<>(elements);
-        this.prev = prev;
-        this.next = next;
     }
 
     /**
@@ -117,7 +101,7 @@
             DocPath filename = DocPaths.indexN(li.nextIndex());
             SplitIndexWriter indexgen = new SplitIndexWriter(configuration,
                     path.resolve(filename),
-                    indexbuilder, keys, prev, next);
+                    indexbuilder, keys);
             indexgen.generateIndexFile((Character) ch);
             if (!li.hasNext()) {
                 indexgen.createSearchIndexFiles();
@@ -182,40 +166,4 @@
             contentTree.addContent(Contents.SPACE);
         }
     }
-
-    /**
-     * Get link to the previous unicode character.
-     *
-     * @return a content tree for the link
-     */
-    @Override
-    public Content getNavLinkPrevious() {
-        Content prevletterLabel = contents.prevLetter;
-        if (prev == -1) {
-            return HtmlTree.LI(prevletterLabel);
-        }
-        else {
-            Content prevLink = links.createLink(DocPaths.indexN(prev),
-                    prevletterLabel);
-            return HtmlTree.LI(prevLink);
-        }
-    }
-
-    /**
-     * Get link to the next unicode character.
-     *
-     * @return a content tree for the link
-     */
-    @Override
-    public Content getNavLinkNext() {
-        Content nextletterLabel = contents.nextLetter;
-        if (next == -1) {
-            return HtmlTree.LI(nextletterLabel);
-        }
-        else {
-            Content nextLink = links.createLink(DocPaths.indexN(next),
-                    nextletterLabel);
-            return HtmlTree.LI(nextLink);
-        }
-    }
 }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactoryImpl.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactoryImpl.java	Tue Feb 06 18:28:23 2018 -0800
@@ -76,36 +76,31 @@
      * {@inheritDoc}
      */
     @Override
-    public PackageSummaryWriter getPackageSummaryWriter(PackageElement packageElement,
-            PackageElement prevPkg, PackageElement nextPkg) {
-        return new PackageWriterImpl(configuration, packageElement, prevPkg, nextPkg);
+    public PackageSummaryWriter getPackageSummaryWriter(PackageElement packageElement) {
+        return new PackageWriterImpl(configuration, packageElement);
     }
 
     /**
      * {@inheritDoc}
      */
-    public ModuleSummaryWriter getModuleSummaryWriter(ModuleElement mdle,
-        ModuleElement prevModule, ModuleElement nextModule) {
-        return new ModuleWriterImpl(configuration, mdle,
-            prevModule, nextModule);
+    public ModuleSummaryWriter getModuleSummaryWriter(ModuleElement mdle) {
+        return new ModuleWriterImpl(configuration, mdle);
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public ClassWriter getClassWriter(TypeElement typeElement, TypeElement prevClass,
-            TypeElement nextClass, ClassTree classTree) {
-        return new ClassWriterImpl(configuration, typeElement, prevClass, nextClass, classTree);
+    public ClassWriter getClassWriter(TypeElement typeElement, ClassTree classTree) {
+        return new ClassWriterImpl(configuration, typeElement, classTree);
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public AnnotationTypeWriter getAnnotationTypeWriter(TypeElement annotationType,
-            TypeMirror prevType, TypeMirror nextType) {
-        return new AnnotationTypeWriterImpl(configuration, annotationType, prevType, nextType);
+    public AnnotationTypeWriter getAnnotationTypeWriter(TypeElement annotationType) {
+        return new AnnotationTypeWriterImpl(configuration, annotationType);
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Tue Feb 06 18:28:23 2018 -0800
@@ -16,16 +16,6 @@
 doclet.Interface_Hierarchy=Interface Hierarchy
 doclet.Enum_Hierarchy=Enum Hierarchy
 doclet.Annotation_Type_Hierarchy=Annotation Type Hierarchy
-doclet.Prev=Prev
-doclet.Next=Next
-doclet.Prev_Class=Prev Class
-doclet.Next_Class=Next Class
-doclet.Prev_Package=Prev Package
-doclet.Next_Package=Next Package
-doclet.Prev_Module=Prev Module
-doclet.Next_Module=Next Module
-doclet.Prev_Letter=Prev Letter
-doclet.Next_Letter=Next Letter
 doclet.Href_Class_Title=class in {0}
 doclet.Href_Interface_Title=interface in {0}
 doclet.Href_Annotation_Title=annotation in {0}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WriterFactory.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WriterFactory.java	Tue Feb 06 18:28:23 2018 -0800
@@ -59,50 +59,38 @@
      * Return the writer for the package summary.
      *
      * @param packageElement the package being documented.
-     * @param prevPkg the previous package that was documented.
-     * @param nextPkg the next package being documented.
      * @return the writer for the package summary.  Return null if this
      * writer is not supported by the doclet.
      */
-    public abstract PackageSummaryWriter getPackageSummaryWriter(PackageElement
-        packageElement, PackageElement prevPkg, PackageElement nextPkg);
+    public abstract PackageSummaryWriter getPackageSummaryWriter(PackageElement packageElement);
 
     /**
      * Return the writer for the module summary.
      *
      * @param mdle the module being documented.
-     * @param prevModule the previous module that was documented.
-     * @param nextModule the next module being documented.
      * @return the writer for the module summary.  Return null if this
      * writer is not supported by the doclet.
      */
-    public abstract ModuleSummaryWriter getModuleSummaryWriter(
-        ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule);
+    public abstract ModuleSummaryWriter getModuleSummaryWriter(ModuleElement mdle);
 
     /**
      * Return the writer for a class.
      *
      * @param typeElement the class being documented.
-     * @param prevClass the previous class that was documented.
-     * @param nextClass the next class being documented.
      * @param classTree the class tree.
      * @return the writer for the class.  Return null if this
      * writer is not supported by the doclet.
      */
-    public abstract ClassWriter getClassWriter(TypeElement typeElement,
-        TypeElement prevClass, TypeElement nextClass, ClassTree classTree);
+    public abstract ClassWriter getClassWriter(TypeElement typeElement, ClassTree classTree);
 
     /**
      * Return the writer for an annotation type.
      *
      * @param annotationType the type being documented.
-     * @param prevType the previous type that was documented.
-     * @param nextType the next type being documented.
      * @return the writer for the annotation type.  Return null if this
      * writer is not supported by the doclet.
      */
-    public abstract AnnotationTypeWriter getAnnotationTypeWriter(
-        TypeElement annotationType, TypeMirror prevType, TypeMirror nextType);
+    public abstract AnnotationTypeWriter getAnnotationTypeWriter(TypeElement annotationType);
 
     /**
      * Return the method writer for a given class.
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java	Tue Feb 06 18:28:23 2018 -0800
@@ -88,59 +88,47 @@
      * Return the builder that builds the package summary.
      *
      * @param pkg the package being documented.
-     * @param prevPkg the previous package being documented.
-     * @param nextPkg the next package being documented.
      * @return the builder that builds the package summary.
      */
-    public AbstractBuilder getPackageSummaryBuilder(PackageElement pkg, PackageElement prevPkg,
-            PackageElement nextPkg) {
+    public AbstractBuilder getPackageSummaryBuilder(PackageElement pkg) {
         return PackageSummaryBuilder.getInstance(context, pkg,
-            writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg));
+            writerFactory.getPackageSummaryWriter(pkg));
     }
 
     /**
      * Return the builder that builds the module summary.
      *
      * @param mdle the module being documented.
-     * @param prevModule the previous module being documented.
-     * @param nextModule the next module being documented.
      * @return the builder that builds the module summary.
      */
-    public AbstractBuilder getModuleSummaryBuilder(ModuleElement mdle, ModuleElement prevModule,
-            ModuleElement nextModule) {
+    public AbstractBuilder getModuleSummaryBuilder(ModuleElement mdle) {
         return ModuleSummaryBuilder.getInstance(context, mdle,
-            writerFactory.getModuleSummaryWriter(mdle, prevModule, nextModule));
+            writerFactory.getModuleSummaryWriter(mdle));
     }
 
     /**
      * Return the builder for the class.
      *
      * @param typeElement the class being documented.
-     * @param prevClass the previous class that was documented.
-     * @param nextClass the next class being documented.
      * @param classTree the class tree.
      * @return the writer for the class.  Return null if this
      * writer is not supported by the doclet.
      */
-    public AbstractBuilder getClassBuilder(TypeElement typeElement,
-            TypeElement prevClass, TypeElement nextClass, ClassTree classTree) {
+    public AbstractBuilder getClassBuilder(TypeElement typeElement, ClassTree classTree) {
         return ClassBuilder.getInstance(context, typeElement,
-            writerFactory.getClassWriter(typeElement, prevClass, nextClass, classTree));
+            writerFactory.getClassWriter(typeElement, classTree));
     }
 
     /**
      * Return the builder for the annotation type.
      *
      * @param annotationType the annotation type being documented.
-     * @param prevType the previous type that was documented.
-     * @param nextType the next type being documented.
      * @return the writer for the annotation type.  Return null if this
      * writer is not supported by the doclet.
      */
-    public AbstractBuilder getAnnotationTypeBuilder(
-        TypeElement annotationType, TypeMirror prevType, TypeMirror nextType) {
+    public AbstractBuilder getAnnotationTypeBuilder(TypeElement annotationType) {
         return AnnotationTypeBuilder.getInstance(context, annotationType,
-            writerFactory.getAnnotationTypeWriter(annotationType, prevType, nextType));
+            writerFactory.getAnnotationTypeWriter(annotationType));
     }
 
     /**
--- a/test/langtools/jdk/javadoc/doclet/testIndexFiles/TestIndexFiles.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testIndexFiles/TestIndexFiles.java	Tue Feb 06 18:28:23 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8170825
+ * @bug      8170825 8196027
  * @summary  Perform tests on index files generated by javadoc.
  * @author   bpatel
  * @library  ../lib
@@ -44,7 +44,7 @@
         javadoc("-d", "out", "-splitindex", "-Xdoclint:none", "-sourcepath", testSrc,
                 "-use", "pkg");
         checkExit(Exit.OK);
-        checkIndexFiles(true);
+        checkIndexFiles(false);
     }
 
     void checkIndexFiles(boolean found) {
@@ -54,10 +54,10 @@
         checkOutput("index-files/index-5.html", found,
                 "<li><a href=\"index-4.html\">Prev Letter</a></li>\n"
                 + "<li>Next Letter</li>");
-        checkOutput("index-files/index-1.html", !found,
+        checkOutput("index-files/index-1.html", found,
                 "<li><a href=\"index-0.html\">Prev Letter</a></li>\n"
                 + "<li><a href=\"index-1.html\">Next Letter</a></li>");
-        checkOutput("index-files/index-5.html", !found,
+        checkOutput("index-files/index-5.html", found,
                 "<li><a href=\"index-4.html\">Prev Letter</a></li>\n"
                 + "<li><a href=\"index-5.html\">Next Letter</a></li>");
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testNavigation/TestModuleNavigation.java	Tue Feb 06 18:28:23 2018 -0800
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2018, 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 8196027
+ * @summary test navigation links
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.javadoc/jdk.javadoc.internal.api
+ *          jdk.javadoc/jdk.javadoc.internal.tool
+ * @library ../lib /tools/lib
+ * @build toolbox.ToolBox toolbox.ModuleBuilder JavadocTester
+ * @run main TestModuleNavigation
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import toolbox.*;
+
+public class TestModuleNavigation extends JavadocTester {
+
+    public final ToolBox tb;
+    public static void main(String... args) throws Exception {
+        TestModuleNavigation  tester = new TestModuleNavigation ();
+        tester.runTests(m -> new Object[] { Paths.get(m.getName()) });
+    }
+
+    public TestModuleNavigation () {
+        tb = new ToolBox();
+    }
+
+    @Test
+    public void checkNavbar(Path base) throws Exception {
+        Path src = Files.createDirectories(base.resolve("src"));
+        ModuleBuilder mb = new ModuleBuilder(tb, "m")
+                .comment("module m.\n@uses p1.A")
+                .uses("p1.A")
+                .uses("p1.B")
+                .exports("p1")
+                .classes("package p1; public class A {}")
+                .classes("package p1; public class B {}");
+        mb.write(src);
+        ModuleBuilder mb1 = new ModuleBuilder(tb, "m2")
+                .comment("module m2.\n@uses m2p1.Am2")
+                .uses("m2p1.Am2")
+                .uses("m2p1.Bm2")
+                .exports("m2p1")
+                .classes("package m2p1; public class Am2 {}")
+                .classes("package m2p1; public class Bm2 {}");
+        mb1.write(src);
+
+        javadoc("-d", base.resolve("out").toString(), "-use",
+                "-quiet",
+                "--module-source-path", src.toString(),
+                "--module", "m,m2");
+        checkExit(Exit.OK);
+
+        checkOutput("overview-summary.html", false,
+                "Prev",
+                "Next");
+
+        checkOutput("m-summary.html", false,
+                "Prev&nbsp;Module",
+                "Next&nbsp;Module");
+
+        checkOutput("m2p1/package-summary.html", false,
+                "Prev&nbsp;Package",
+                "Next&nbsp;Package");
+
+        checkOutput("m2p1/Am2.html", false,
+                "Prev&nbsp;Class",
+                "Next&nbsp;Class");
+
+        checkOutput("m2p1/class-use/Am2.html", false,
+                "Prev",
+                "Next");
+
+        checkOutput("m2p1/package-tree.html", false,
+                "Prev",
+                "Next");
+
+        checkOutput("deprecated-list.html", false,
+                "Prev",
+                "Next");
+
+        checkOutput("index-all.html", false,
+                "Prev",
+                "Next");
+    }
+}
--- a/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java	Tue Feb 06 16:33:38 2018 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java	Tue Feb 06 18:28:23 2018 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4131628 4664607 7025314 8023700 7198273 8025633 8026567 8081854 8150188 8151743
+ * @bug      4131628 4664607 7025314 8023700 7198273 8025633 8026567 8081854 8150188 8151743 8196027
  * @summary  Make sure the Next/Prev Class links iterate through all types.
  *           Make sure the navagation is 2 columns, not 3.
  * @author   jamieh
@@ -48,23 +48,18 @@
         checkExit(Exit.OK);
 
         checkOutput("pkg/A.html", true,
-                "<li>Prev&nbsp;Class</li>",
-                "<a href=\"C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Next&nbsp;Class</span></a>",
+                "<ul class=\"navList\" title=\"Navigation\">\n" +
                 "<li><a href=\"../overview-summary.html\">Overview</a></li>");
 
         checkOutput("pkg/C.html", true,
-                "<a href=\"A.html\" title=\"annotation in pkg\"><span class=\"typeNameLink\">Prev&nbsp;Class</span></a>",
-                "<a href=\"E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Next&nbsp;Class</span></a>",
+                "<ul class=\"navList\" title=\"Navigation\">\n" +
                 "<li><a href=\"../overview-summary.html\">Overview</a></li>");
 
         checkOutput("pkg/E.html", true,
-                "<a href=\"C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Prev&nbsp;Class</span></a>",
-                "<a href=\"I.html\" title=\"interface in pkg\"><span class=\"typeNameLink\">Next&nbsp;Class</span></a>",
+                "<ul class=\"navList\" title=\"Navigation\">\n" +
                 "<li><a href=\"../overview-summary.html\">Overview</a></li>");
 
         checkOutput("pkg/I.html", true,
-                "<a href=\"E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Prev&nbsp;Class</span></a>",
-                "<li>Next&nbsp;Class</li>",
                 // Test for 4664607
                 "<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>\n"
                 + "<a name=\"navbar.top.firstrow\">\n"