OpenJDK / amber / amber
changeset 44195:5860769fe2f4
8175799: module summary page shows duplicated output
Reviewed-by: jjg, ksrini
author | bpatel |
---|---|
date | Mon, 13 Mar 2017 09:55:31 -0700 |
parents | c868c8c24e18 |
children | f88c0e9cb102 |
files | langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java langtools/test/jdk/javadoc/doclet/testModules/TestModules.java langtools/test/jdk/javadoc/doclet/testModules/overview.html |
diffstat | 4 files changed, 103 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java Fri Mar 10 09:52:49 2017 -0800 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java Mon Mar 13 09:55:31 2017 -0700 @@ -144,7 +144,6 @@ Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table); if (configuration.allowTag(HtmlTag.MAIN)) { htmlTree.addContent(div); - body.addContent(htmlTree); } else { body.addContent(div); } @@ -189,7 +188,6 @@ addOverviewComment(div); if (configuration.allowTag(HtmlTag.MAIN)) { htmlTree.addContent(div); - body.addContent(htmlTree); } else { body.addContent(div); } @@ -210,12 +208,16 @@ } /** - * Not required for this page. + * For HTML 5, add the htmlTree to the body. For HTML 4, do nothing. * * @param body the documentation tree to which the overview will be added */ @Override - protected void addOverview(Content body) {} + protected void addOverview(Content body) { + if (configuration.allowTag(HtmlTag.MAIN)) { + body.addContent(htmlTree); + } + } /** * Adds the top text (from the -top option), the upper
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java Fri Mar 10 09:52:49 2017 -0800 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java Mon Mar 13 09:55:31 2017 -0700 @@ -134,7 +134,6 @@ Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table); if (configuration.allowTag(HtmlTag.MAIN)) { htmlTree.addContent(div); - body.addContent(htmlTree); } else { body.addContent(div); } @@ -182,7 +181,6 @@ addOverviewComment(div); if (configuration.allowTag(HtmlTag.MAIN)) { htmlTree.addContent(div); - body.addContent(htmlTree); } else { body.addContent(div); } @@ -203,12 +201,16 @@ } /** - * Not required for this page. + * For HTML 5, add the htmlTree to the body. For HTML 4, do nothing. * * @param body the documentation tree to which the overview will be added */ @Override - protected void addOverview(Content body) {} + protected void addOverview(Content body) { + if (configuration.allowTag(HtmlTag.MAIN)) { + body.addContent(htmlTree); + } + } /** * Adds the top text (from the -top option), the upper
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Fri Mar 10 09:52:49 2017 -0800 +++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Mon Mar 13 09:55:31 2017 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674 8160196 + * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674 8160196 8175799 * @summary Test modules support in javadoc. * @author bpatel * @library ../lib @@ -44,6 +44,7 @@ @Test void testHtml4() { javadoc("-d", "out", "-use", + "-overview", testSrc("overview.html"), "--module-source-path", testSrc, "--module", "moduleA,moduleB", "testpkgmdlA", "testpkgmdlB"); @@ -65,6 +66,7 @@ @Test void testHtml5() { javadoc("-d", "out-html5", "-html5", "-use", + "-overview", testSrc("overview.html"), "--module-source-path", testSrc, "--module", "moduleA,moduleB", "testpkgmdlA", "testpkgmdlB"); @@ -86,6 +88,7 @@ @Test void testHtml4NoComment() { javadoc("-d", "out-nocomment", "-nocomment", "-use", + "-overview", testSrc("overview.html"), "--module-source-path", testSrc, "--module", "moduleA,moduleB", "testpkgmdlA", "testpkgmdlB"); @@ -103,6 +106,7 @@ @Test void testHtml5NoComment() { javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use", + "-overview", testSrc("overview.html"), "--module-source-path", testSrc, "--module", "moduleA,moduleB", "testpkgmdlA", "testpkgmdlB"); @@ -120,6 +124,7 @@ @Test void testHtml4UnnamedModule() { javadoc("-d", "out-nomodule", "-use", + "-overview", testSrc("overview.html"), "-sourcepath", testSrc, "testpkgnomodule", "testpkgnomodule1"); checkExit(Exit.OK); @@ -136,6 +141,7 @@ @Test void testHtml5UnnamedModule() { javadoc("-d", "out-html5-nomodule", "-html5", "-use", + "-overview", testSrc("overview.html"), "-sourcepath", testSrc, "testpkgnomodule", "testpkgnomodule1"); checkExit(Exit.OK); @@ -265,6 +271,23 @@ + "</a>\n" + "<div class=\"block\">This is a test description for the moduleB module. Search " + "word <a id=\"search_word\">search_word</a> with no description.</div>"); + checkOutput("overview-summary.html", found, + "</script>\n" + + "<div class=\"contentContainer\">\n" + + "<div class=\"block\">The overview summary page header.</div>\n" + + "</div>\n" + + "<div class=\"contentContainer\">\n" + + "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n" + + "<caption><span>Modules</span><span class=\"tabEnd\"> </span></caption>"); + checkOutput("overview-summary.html", false, + "</table>\n" + + "</div>\n" + + "<div class=\"contentContainer\">\n" + + "<div class=\"block\">The overview summary page header.</div>\n" + + "</div>\n" + + "<div class=\"contentContainer\">\n" + + "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n" + + "<caption><span>Modules</span><span class=\"tabEnd\"> </span></caption>"); } void checkNoDescription(boolean found) { @@ -305,6 +328,27 @@ + "</a>\n" + "<div class=\"block\">This is a test description for the moduleB module. Search " + "word <a id=\"search_word\">search_word</a> with no description.</div>"); + checkOutput("overview-summary.html", found, + "</nav>\n" + + "</header>\n" + + "<main role=\"main\">\n" + + "<div class=\"contentContainer\">\n" + + "<div class=\"block\">The overview summary page header.</div>\n" + + "</div>\n" + + "<div class=\"contentContainer\">\n" + + "<table class=\"overviewSummary\">\n" + + "<caption><span>Modules</span><span class=\"tabEnd\"> </span></caption>"); + checkOutput("overview-summary.html", false, + "</table>\n" + + "</div>\n" + + "</main>\n" + + "<main role=\"main\">\n" + + "<div class=\"contentContainer\">\n" + + "<div class=\"block\">The overview summary page header.</div>\n" + + "</div>\n" + + "<div class=\"contentContainer\">\n" + + "<table class=\"overviewSummary\">\n" + + "<caption><span>Modules</span><span class=\"tabEnd\"> </span></caption>"); } void checkHtml5NoDescription(boolean found) { @@ -403,14 +447,29 @@ + "<tr>\n" + "<th class=\"colFirst\" scope=\"col\">Module</th>\n" + "<th class=\"colLast\" scope=\"col\">Description</th>\n" - + "</tr>"); + + "</tr>", + "</table>\n" + + "</div>\n" + + "<div class=\"contentContainer\">\n" + + "<div class=\"block\">The overview summary page header.</div>\n" + + "</div>\n" + + "<div class=\"contentContainer\">\n" + + "<table class=\"overviewSummary\" summary=\"Packages table, listing packages, and an explanation\">\n" + + "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>"); checkOutput("overview-summary.html", true, "<table class=\"overviewSummary\" summary=\"Packages table, listing packages, and an explanation\">\n" + "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>\n" + "<tr>\n" + "<th class=\"colFirst\" scope=\"col\">Package</th>\n" + "<th class=\"colLast\" scope=\"col\">Description</th>\n" - + "</tr>"); + + "</tr>", + "</script>\n" + + "<div class=\"contentContainer\">\n" + + "<div class=\"block\">The overview summary page header.</div>\n" + + "</div>\n" + + "<div class=\"contentContainer\">\n" + + "<table class=\"overviewSummary\" summary=\"Packages table, listing packages, and an explanation\">\n" + + "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>"); } void checkHtml5OverviewSummaryModules() { @@ -437,14 +496,34 @@ + "<tr>\n" + "<th class=\"colFirst\" scope=\"col\">Module</th>\n" + "<th class=\"colLast\" scope=\"col\">Description</th>\n" - + "</tr>"); + + "</tr>", + "</table>\n" + + "</div>\n" + + "</main>\n" + + "<main role=\"main\">\n" + + "<div class=\"contentContainer\">\n" + + "<div class=\"block\">The overview summary page header.</div>\n" + + "</div>\n" + + "<div class=\"contentContainer\">\n" + + "<table class=\"overviewSummary\">\n" + + "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>"); checkOutput("overview-summary.html", true, "<table class=\"overviewSummary\">\n" + "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>\n" + "<tr>\n" + "<th class=\"colFirst\" scope=\"col\">Package</th>\n" + "<th class=\"colLast\" scope=\"col\">Description</th>\n" - + "</tr>"); + + "</tr>", + "</script>\n" + + "</nav>\n" + + "</header>\n" + + "<main role=\"main\">\n" + + "<div class=\"contentContainer\">\n" + + "<div class=\"block\">The overview summary page header.</div>\n" + + "</div>\n" + + "<div class=\"contentContainer\">\n" + + "<table class=\"overviewSummary\">\n" + + "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>"); } void checkModuleSummary() {