8166306: Broken link for All Packages in java.jnlp module

Reviewed-by: jjg, ksrini
This commit is contained in:
Bhavesh Patel 2017-04-26 08:15:40 -07:00
parent 5c0906b9eb
commit 0a6bfe2343
3 changed files with 51 additions and 5 deletions

View File

@ -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 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
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);

View File

@ -271,14 +271,14 @@ public class HtmlDoclet extends AbstractDoclet {
@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);
}

View File

@ -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 @@ public class TestModules extends JavadocTester {
checkModuleModeCommon();
checkModuleModeApi(true);
checkModuleModeAll(false);
checkModuleFrameFiles(true);
checkAllModulesLink(true);
}
/**
@ -268,6 +270,8 @@ public class TestModules extends JavadocTester {
checkModuleModeCommon();
checkModuleModeApi(false);
checkModuleModeAll(true);
checkModuleFrameFiles(true);
checkAllModulesLink(true);
}
/**
@ -296,6 +300,32 @@ public class TestModules extends JavadocTester {
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 @@ public class TestModules extends JavadocTester {
"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&nbsp;Modules</a></li>");
}
void checkModulesInSearch(boolean found) {
checkOutput("index-all.html", found,
"<dl>\n"