# HG changeset patch
# User bpatel
# Date 1489424131 25200
# Node ID 5860769fe2f477eb249c8fea748cf68c89cb8ef0
# Parent c868c8c24e18979690bd240d2dc9f7b4bb848295
8175799: module summary page shows duplicated output
Reviewed-by: jjg, ksrini
diff -r c868c8c24e18 -r 5860769fe2f4 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
--- 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
diff -r c868c8c24e18 -r 5860769fe2f4 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java
--- 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
diff -r c868c8c24e18 -r 5860769fe2f4 langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
--- 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 @@
+ "\n"
+ "
This is a test description for the moduleB module. Search "
+ "word
search_word with no description.
");
+ checkOutput("overview-summary.html", found,
+ "\n"
+ + "\n"
+ + "
The overview summary page header.
\n"
+ + "
\n"
+ + "\n"
+ + "
\n"
+ + "Modules ");
+ checkOutput("overview-summary.html", false,
+ "
\n"
+ + "
\n"
+ + "\n"
+ + "
The overview summary page header.
\n"
+ + "
\n"
+ + "\n"
+ + "
\n"
+ + "Modules ");
}
void checkNoDescription(boolean found) {
@@ -305,6 +328,27 @@
+ "\n"
+ "This is a test description for the moduleB module. Search "
+ "word
search_word with no description.
");
+ checkOutput("overview-summary.html", found,
+ "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "
The overview summary page header.
\n"
+ + "
\n"
+ + "\n"
+ + "
\n"
+ + "Modules ");
+ checkOutput("overview-summary.html", false,
+ "
\n"
+ + "
\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "
The overview summary page header.
\n"
+ + "
\n"
+ + "\n"
+ + "
\n"
+ + "Modules ");
}
void checkHtml5NoDescription(boolean found) {
@@ -403,14 +447,29 @@
+ "\n"
+ "Module | \n"
+ "Description | \n"
- + "
");
+ + "",
+ "
\n"
+ + "
\n"
+ + "\n"
+ + "
The overview summary page header.
\n"
+ + "
\n"
+ + "\n"
+ + "
\n"
+ + "Packages ");
checkOutput("overview-summary.html", true,
"\n"
+ "Packages \n"
+ "\n"
+ "Package | \n"
+ "Description | \n"
- + "
");
+ + "",
+ "\n"
+ + "\n"
+ + "
The overview summary page header.
\n"
+ + "
\n"
+ + "\n"
+ + "
\n"
+ + "Packages ");
}
void checkHtml5OverviewSummaryModules() {
@@ -437,14 +496,34 @@
+ "\n"
+ "Module | \n"
+ "Description | \n"
- + "
");
+ + "",
+ "
\n"
+ + "
\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "
The overview summary page header.
\n"
+ + "
\n"
+ + "\n"
+ + "
\n"
+ + "Packages ");
checkOutput("overview-summary.html", true,
"\n"
+ "Packages \n"
+ "\n"
+ "Package | \n"
+ "Description | \n"
- + "
");
+ + "",
+ "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "
The overview summary page header.
\n"
+ + "
\n"
+ + "\n"
+ + "
\n"
+ + "Packages ");
}
void checkModuleSummary() {
diff -r c868c8c24e18 -r 5860769fe2f4 langtools/test/jdk/javadoc/doclet/testModules/overview.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/overview.html Mon Mar 13 09:55:31 2017 -0700
@@ -0,0 +1,6 @@
+
+
+
+ The overview summary page header.
+
+