8176778: javadoc does not produce summary pages for aggregated modules

Reviewed-by: bpatel, jjg
This commit is contained in:
Kumar Srinivasan 2017-03-15 06:30:33 -07:00
parent 5770a10028
commit 61b8ab43b2
4 changed files with 83 additions and 3 deletions

View File

@ -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
@ -25,6 +25,7 @@
package jdk.javadoc.internal.doclets.formats.html;
import java.util.Collections;
import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.List;
@ -284,12 +285,14 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
additionalModules.remove(m);
}
});
// Get all packages for the module and put it in the concealed packages set.
(utils.getModulePackageMap().get(mdle)).forEach((pkg) -> {
utils.getModulePackageMap().getOrDefault(mdle, Collections.emptySet()).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();

View File

@ -441,6 +441,11 @@ public abstract class Configuration {
}
}
// add entries for modules which may not have exported packages
modules.forEach((ModuleElement mdle) -> {
modulePackages.computeIfAbsent(mdle, m -> Collections.emptySet());
});
modules.addAll(modulePackages.keySet());
showModules = !modules.isEmpty();
for (Set<PackageElement> pkgs : modulePackages.values()) {

View File

@ -24,7 +24,7 @@
/*
* @test
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
* 8168766 8168688 8162674 8160196 8175799 8174974
* 8168766 8168688 8162674 8160196 8175799 8174974 8176778
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@ -181,6 +181,19 @@ public class TestModules extends JavadocTester {
checkNegatedModuleSummary();
}
/**
* Test generated module summary page of an aggregating module.
*/
@Test
void testAggregatorModuleSummary() {
javadoc("-d", "out-aggregatorModuleSummary", "-use",
"--module-source-path", testSrc,
"--expand-requires", "transitive",
"--module", "moduleT");
checkExit(Exit.OK);
checkAggregatorModuleSummary();
}
/**
* Test generated module pages and pages with link to modules.
*/
@ -599,6 +612,32 @@ public class TestModules extends JavadocTester {
+ "</tr>");
}
void checkAggregatorModuleSummary() {
checkOutput("moduleT-summary.html", true,
"<div class=\"header\">\n"
+ "<h1 title=\"Module\" class=\"title\">Module&nbsp;moduleT</h1>\n"
+ "</div>",
"<div class=\"block\">This is a test description for the moduleT module. "
+ "Search phrase <a id=\"searchphrase\">search phrase</a>. "
+ "Make sure there are no exported packages.</div>",
"<tbody>\n"
+ "<tr class=\"altColor\">\n"
+ "<td class=\"colFirst\">transitive</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>\n"
+ "</tr>\n"
+ "<tr class=\"rowColor\">\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>\n"
+ "</tbody>");
}
void checkNegatedModuleSummary() {
checkOutput("moduleA-summary.html", false,
"<!-- ============ SERVICES SUMMARY =========== -->\n"

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 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
* 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 moduleT module. Search phrase {@index "search phrase" with description}. Make sure there are no exported packages.
*
*/
module moduleT {
requires transitive moduleA;
requires transitive moduleB;
}