# HG changeset patch # User ksrini # Date 1489584633 25200 # Node ID 2f47b2c166126f2d5ae1e929496b2b9de7bf98bf # Parent 0a87e188cae7abdd15b6d69fad93db891efd8be3 8176778: javadoc does not produce summary pages for aggregated modules Reviewed-by: bpatel, jjg diff -r 0a87e188cae7 -r 2f47b2c16612 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Wed Mar 15 11:42:42 2017 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Wed Mar 15 06:30:33 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 @@ -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 @@ 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(); diff -r 0a87e188cae7 -r 2f47b2c16612 langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java Wed Mar 15 11:42:42 2017 +0000 +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java Wed Mar 15 06:30:33 2017 -0700 @@ -441,6 +441,11 @@ } } + // 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 pkgs : modulePackages.values()) { diff -r 0a87e188cae7 -r 2f47b2c16612 langtools/test/jdk/javadoc/doclet/testModules/TestModules.java --- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Wed Mar 15 11:42:42 2017 +0000 +++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Wed Mar 15 06:30:33 2017 -0700 @@ -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 @@ -182,6 +182,19 @@ } /** + * 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. */ @Test @@ -599,6 +612,32 @@ + ""); } + void checkAggregatorModuleSummary() { + checkOutput("moduleT-summary.html", true, + "
\n" + + "

Module moduleT

\n" + + "
", + "
This is a test description for the moduleT module. " + + "Search phrase search phrase. " + + "Make sure there are no exported packages.
", + "\n" + + "\n" + + "transitive\n" + + "moduleA\n" + + "\n" + + "
This is a test description for the moduleA module.
\n" + + "\n" + + "\n" + + "\n" + + "transitive\n" + + "moduleB\n" + + "\n" + + "
This is a test description for the moduleB module.
\n" + + "\n" + + "\n" + + ""); + } + void checkNegatedModuleSummary() { checkOutput("moduleA-summary.html", false, "\n" diff -r 0a87e188cae7 -r 2f47b2c16612 langtools/test/jdk/javadoc/doclet/testModules/moduleT/module-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleT/module-info.java Wed Mar 15 06:30:33 2017 -0700 @@ -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; +}