8166306: Broken link for All Packages in java.jnlp module
Reviewed-by: jjg, ksrini
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Tue Apr 25 18:35:24 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Wed Apr 26 08:15:40 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -160,7 +160,7 @@
htmlTree.addStyle(HtmlStyle.indexNav);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
addAllClassesLink(ul);
- if (configuration.showModules) {
+ if (configuration.showModules && configuration.modules.size() > 1) {
addAllModulesLink(ul);
}
htmlTree.addContent(ul);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java Tue Apr 25 18:35:24 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java Wed Apr 26 08:15:40 2017 -0700
@@ -271,14 +271,14 @@
@Override // defined by AbstractDoclet
protected void generateModuleFiles() throws DocletException {
if (configuration.showModules) {
- if (configuration.frames) {
+ 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) {
- if (configuration.frames) {
+ if (configuration.frames && configuration.modules.size() > 1) {
ModulePackageIndexFrameWriter.generate(configuration, mdle);
ModuleFrameWriter.generate(configuration, mdle);
}
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Tue Apr 25 18:35:24 2017 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Wed Apr 26 08:15:40 2017 -0700
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
- * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823
+ * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823 8166306
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@@ -251,6 +251,8 @@
checkModuleModeCommon();
checkModuleModeApi(true);
checkModuleModeAll(false);
+ checkModuleFrameFiles(true);
+ checkAllModulesLink(true);
}
/**
@@ -268,6 +270,8 @@
checkModuleModeCommon();
checkModuleModeApi(false);
checkModuleModeAll(true);
+ checkModuleFrameFiles(true);
+ checkAllModulesLink(true);
}
/**
@@ -296,6 +300,32 @@
checkModuleSummaryNoExported(false);
}
+ /**
+ * Test generated module pages for javadoc run for a single module having a single package.
+ */
+ @Test
+ void testSingleModuleSinglePkg() {
+ javadoc("-d", "out-singlemod",
+ "--module-source-path", testSrc,
+ "--module", "moduleC",
+ "testpkgmdlC");
+ checkExit(Exit.OK);
+ checkModuleFrameFiles(false);
+ }
+
+ /**
+ * Test generated module pages for javadoc run for a single module having multiple packages.
+ */
+ @Test
+ void testSingleModuleMultiplePkg() {
+ javadoc("-d", "out-singlemodmultiplepkg", "--show-module-contents=all",
+ "--module-source-path", testSrc,
+ "--module", "moduleB",
+ "testpkg2mdlB", "testpkgmdlB");
+ checkExit(Exit.OK);
+ checkAllModulesLink(false);
+ }
+
void checkDescription(boolean found) {
checkOutput("moduleA-summary.html", found,
"<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -710,6 +740,22 @@
"module-overview-frame.html");
}
+ void checkModuleFrameFiles(boolean found) {
+ checkFiles(found,
+ "moduleC-frame.html",
+ "moduleC-type-frame.html",
+ "module-overview-frame.html");
+ checkFiles(true,
+ "moduleC-summary.html",
+ "allclasses-frame.html",
+ "allclasses-noframe.html");
+ }
+
+ void checkAllModulesLink(boolean found) {
+ checkOutput("overview-frame.html", found,
+ "<li><a href=\"module-overview-frame.html\" target=\"packageListFrame\">All Modules</a></li>");
+ }
+
void checkModulesInSearch(boolean found) {
checkOutput("index-all.html", found,
"<dl>\n"