8155995: Update javadoc to include module search
Reviewed-by: jjg, ksrini
This commit is contained in:
parent
1c7781b760
commit
efdde296cd
@ -32,6 +32,7 @@ import java.util.zip.*;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.util.SimpleElementVisitor9;
|
||||
@ -182,6 +183,15 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
SearchIndexItem si = new SearchIndexItem();
|
||||
new SimpleElementVisitor9<Void, Void>() {
|
||||
|
||||
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
|
||||
public Void visitModule(ModuleElement e, Void p) {
|
||||
if (configuration.showModules) {
|
||||
addDescription(e, dl, si);
|
||||
configuration.moduleSearchIndex.add(si);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
|
||||
public Void visitPackage(PackageElement e, Void p) {
|
||||
addDescription(e, dl, si);
|
||||
@ -206,6 +216,27 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
}.visit(element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add one line summary comment for the module.
|
||||
*
|
||||
* @param mdle the module to be documented
|
||||
* @param dlTree the content tree to which the description will be added
|
||||
*/
|
||||
protected void addDescription(ModuleElement mdle, Content dlTree, SearchIndexItem si) {
|
||||
String moduleName = utils.getSimpleName(mdle);
|
||||
Content link = getModuleLink(mdle, new StringContent(moduleName));
|
||||
si.setLabel(moduleName);
|
||||
si.setCategory(resources.getText("doclet.Modules"));
|
||||
Content dt = HtmlTree.DT(link);
|
||||
dt.addContent(" - ");
|
||||
dt.addContent(contents.module_);
|
||||
dt.addContent(" " + moduleName);
|
||||
dlTree.addContent(dt);
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
addSummaryComment(mdle, dd);
|
||||
dlTree.addContent(dd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add one line summary comment for the package.
|
||||
*
|
||||
@ -214,6 +245,9 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
*/
|
||||
protected void addDescription(PackageElement pkg, Content dlTree, SearchIndexItem si) {
|
||||
Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
|
||||
if (configuration.showModules) {
|
||||
si.setContainingModule(utils.getSimpleName(utils.containingModule(pkg)));
|
||||
}
|
||||
si.setLabel(utils.getPackageName(pkg));
|
||||
si.setCategory(resources.getText("doclet.Packages"));
|
||||
Content dt = HtmlTree.DT(link);
|
||||
@ -397,6 +431,10 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
}
|
||||
|
||||
protected void createSearchIndexFiles() {
|
||||
if (configuration.showModules) {
|
||||
createSearchIndexFile(DocPaths.MODULE_SEARCH_INDEX_JSON, DocPaths.MODULE_SEARCH_INDEX_ZIP,
|
||||
configuration.moduleSearchIndex);
|
||||
}
|
||||
createSearchIndexFile(DocPaths.PACKAGE_SEARCH_INDEX_JSON, DocPaths.PACKAGE_SEARCH_INDEX_ZIP,
|
||||
configuration.packageSearchIndex);
|
||||
createSearchIndexFile(DocPaths.TYPE_SEARCH_INDEX_JSON, DocPaths.TYPE_SEARCH_INDEX_ZIP,
|
||||
|
@ -223,6 +223,8 @@ public class ConfigurationImpl extends Configuration {
|
||||
|
||||
protected List<SearchIndexItem> memberSearchIndex = new ArrayList<>();
|
||||
|
||||
protected List<SearchIndexItem> moduleSearchIndex = new ArrayList<>();
|
||||
|
||||
protected List<SearchIndexItem> packageSearchIndex = new ArrayList<>();
|
||||
|
||||
protected List<SearchIndexItem> tagSearchIndex = new ArrayList<>();
|
||||
|
@ -104,6 +104,7 @@ public class Contents {
|
||||
public final Content methodSummary;
|
||||
public final Content methods;
|
||||
public final Content moduleLabel;
|
||||
public final Content module_;
|
||||
public final Content moduleSubNavLabel;
|
||||
public final Content modulesLabel;
|
||||
public final Content navAnnotationTypeMember;
|
||||
@ -216,6 +217,7 @@ public class Contents {
|
||||
methodSummary = getContent("doclet.Method_Summary");
|
||||
methods = getContent("doclet.Methods");
|
||||
moduleLabel = getContent("doclet.Module");
|
||||
module_ = getContent("doclet.module");
|
||||
moduleSubNavLabel = getContent("doclet.Module_Sub_Nav");
|
||||
modulesLabel = getContent("doclet.Modules");
|
||||
navAnnotationTypeMember = getContent("doclet.navAnnotationTypeMember");
|
||||
|
@ -38,6 +38,7 @@ public class SearchIndexItem {
|
||||
private String label = "";
|
||||
private String url = "";
|
||||
private String category = "";
|
||||
private String containingModule = "";
|
||||
private String containingPackage = "";
|
||||
private String containingClass = "";
|
||||
private String holder = "";
|
||||
@ -59,6 +60,10 @@ public class SearchIndexItem {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setContainingModule(String m) {
|
||||
containingModule = m;
|
||||
}
|
||||
|
||||
public void setContainingPackage(String p) {
|
||||
containingPackage = p;
|
||||
}
|
||||
@ -89,10 +94,17 @@ public class SearchIndexItem {
|
||||
|
||||
public String toString() {
|
||||
StringBuilder item = new StringBuilder("");
|
||||
if (category.equals("Packages")) {
|
||||
if (category.equals("Modules")) {
|
||||
item.append("{")
|
||||
.append("\"l\":\"").append(label).append("\"")
|
||||
.append("}");
|
||||
} else if (category.equals("Packages")) {
|
||||
item.append("{");
|
||||
if (!containingModule.isEmpty()) {
|
||||
item.append("\"m\":\"").append(containingModule).append("\",");
|
||||
}
|
||||
item.append("\"l\":\"").append(label).append("\"")
|
||||
.append("}");
|
||||
} else if (category.equals("Types")) {
|
||||
item.append("{")
|
||||
.append("\"p\":\"").append(containingPackage).append("\",")
|
||||
|
@ -28,6 +28,7 @@ package jdk.javadoc.internal.doclets.formats.html;
|
||||
import java.util.List;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
@ -37,7 +38,6 @@ import javax.lang.model.util.SimpleElementVisitor9;
|
||||
import com.sun.source.doctree.DocTree;
|
||||
import com.sun.source.doctree.IndexTree;
|
||||
import com.sun.tools.javac.util.DefinedBy;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
@ -113,6 +113,13 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
si.setLabel(tagText);
|
||||
si.setDescription(desc);
|
||||
new SimpleElementVisitor9<Void, Void>() {
|
||||
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
|
||||
public Void visitModule(ModuleElement e, Void p) {
|
||||
si.setUrl(DocPaths.moduleSummary(e).getPath() + "#" + anchorName);
|
||||
si.setHolder(utils.getSimpleName(element));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override @DefinedBy(DefinedBy.Api.LANGUAGE_MODEL)
|
||||
public Void visitPackage(PackageElement e, Void p) {
|
||||
si.setUrl(DocPath.forPackage(e).getPath()
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, 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 @@
|
||||
|
||||
var noResult = {l: "No results found"};
|
||||
var category = "category";
|
||||
var catModules = "Modules";
|
||||
var catPackages = "Packages";
|
||||
var catTypes = "Types";
|
||||
var catMembers = "Members";
|
||||
@ -115,8 +116,12 @@ $.widget("custom.catcomplete", $.ui.autocomplete, {
|
||||
var regexp = new RegExp($.ui.autocomplete.escapeRegex(result), "i");
|
||||
highlight = "<span class=\"resultHighlight\">$&</span>";
|
||||
var label = "";
|
||||
if (item.category === catPackages) {
|
||||
if (item.category === catModules) {
|
||||
label = item.l.replace(regexp, highlight);
|
||||
} else if (item.category === catPackages) {
|
||||
label = (item.m)
|
||||
? (item.m + "/" + item.l).replace(regexp, highlight)
|
||||
: item.l.replace(regexp, highlight);
|
||||
} else if (item.category === catTypes) {
|
||||
label += (item.p + "." + item.l).replace(regexp, highlight);
|
||||
} else if (item.category === catMembers) {
|
||||
@ -152,24 +157,43 @@ $(function() {
|
||||
delay: 100,
|
||||
source: function(request, response) {
|
||||
var result = new Array();
|
||||
var presult = new Array();
|
||||
var tresult = new Array();
|
||||
var mresult = new Array();
|
||||
var tgresult = new Array();
|
||||
var displayCount = 0;
|
||||
var exactMatcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(request.term) + "$", "i");
|
||||
var secondaryMatcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
|
||||
if (packageSearchIndex) {
|
||||
var pCount = 0;
|
||||
$.each(packageSearchIndex, function(index, item) {
|
||||
item[category] = catPackages;
|
||||
if (moduleSearchIndex) {
|
||||
var mdleCount = 0;
|
||||
$.each(moduleSearchIndex, function(index, item) {
|
||||
item[category] = catModules;
|
||||
if (exactMatcher.test(item.l)) {
|
||||
result.unshift(item);
|
||||
pCount++;
|
||||
mdleCount++;
|
||||
} else if (secondaryMatcher.test(item.l)) {
|
||||
result.push(item);
|
||||
}
|
||||
});
|
||||
displayCount = pCount;
|
||||
displayCount = mdleCount;
|
||||
}
|
||||
if (packageSearchIndex) {
|
||||
var pCount = 0;
|
||||
var pkg = "";
|
||||
$.each(packageSearchIndex, function(index, item) {
|
||||
item[category] = catPackages;
|
||||
pkg = (item.m)
|
||||
? (item.m + "/" + item.l)
|
||||
: item.l;
|
||||
if (exactMatcher.test(item.l)) {
|
||||
presult.unshift(item);
|
||||
pCount++;
|
||||
} else if (secondaryMatcher.test(pkg)) {
|
||||
presult.push(item);
|
||||
}
|
||||
});
|
||||
result = result.concat(presult);
|
||||
displayCount = (pCount > displayCount) ? pCount : displayCount;
|
||||
}
|
||||
if (typeSearchIndex) {
|
||||
var tCount = 0;
|
||||
@ -215,7 +239,7 @@ $(function() {
|
||||
}
|
||||
displayCount = (displayCount > 500) ? displayCount : 500;
|
||||
var counter = function() {
|
||||
var count = {Packages: 0, Types: 0, Members: 0, SearchTags: 0};
|
||||
var count = {Modules: 0, Packages: 0, Types: 0, Members: 0, SearchTags: 0};
|
||||
var f = function(item) {
|
||||
count[item.category] += 1;
|
||||
return (count[item.category] <= displayCount);
|
||||
@ -238,7 +262,9 @@ $(function() {
|
||||
select: function(event, ui) {
|
||||
if (ui.item.l !== noResult.l) {
|
||||
var url = "";
|
||||
if (ui.item.category === catPackages) {
|
||||
if (ui.item.category === catModules) {
|
||||
url = "/" + ui.item.l + "-summary.html";
|
||||
} else if (ui.item.category === catPackages) {
|
||||
url = ui.item.l.replace(/\./g, '/') + "/package-summary.html";
|
||||
} else if (ui.item.category === catTypes) {
|
||||
if (ui.item.p === "<Unnamed>") {
|
||||
|
@ -62,6 +62,7 @@ doclet.Constructor_for=Constructor for {0}
|
||||
doclet.Static_method_in=Static method in {0}
|
||||
doclet.Search_tag_in=Search tag in {0}
|
||||
doclet.Method_in=Method in {0}
|
||||
doclet.module=module
|
||||
doclet.package=package
|
||||
doclet.MalformedURL=Malformed URL: {0}
|
||||
doclet.File_error=Error reading file: {0}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2016, 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,6 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
var moduleSearchIndex;
|
||||
var packageSearchIndex;
|
||||
var typeSearchIndex;
|
||||
var memberSearchIndex;
|
||||
@ -36,6 +37,14 @@ function loadScripts(doc, tag) {
|
||||
}
|
||||
createElem(doc, tag, 'search.js');
|
||||
|
||||
$.get(pathtoroot + "module-search-index.zip")
|
||||
.done(function() {
|
||||
JSZipUtils.getBinaryContent(pathtoroot + "module-search-index.zip", function(e, data) {
|
||||
var zip = new JSZip(data);
|
||||
zip.load(data);
|
||||
moduleSearchIndex = JSON.parse(zip.file("module-search-index.json").asText());
|
||||
});
|
||||
});
|
||||
$.get(pathtoroot + "package-search-index.zip")
|
||||
.done(function() {
|
||||
JSZipUtils.getBinaryContent(pathtoroot + "package-search-index.zip", function(e, data) {
|
||||
|
@ -121,6 +121,12 @@ public class DocPaths {
|
||||
/** The name of the member search index zip file. */
|
||||
public static final DocPath MEMBER_SEARCH_INDEX_ZIP = DocPath.create("member-search-index.zip");
|
||||
|
||||
/** The name of the module search index file. */
|
||||
public static final DocPath MODULE_SEARCH_INDEX_JSON = DocPath.create("module-search-index.json");
|
||||
|
||||
/** The name of the module search index zipfile. */
|
||||
public static final DocPath MODULE_SEARCH_INDEX_ZIP = DocPath.create("module-search-index.zip");
|
||||
|
||||
/** The name of the file for the overview frame. */
|
||||
public static final DocPath OVERVIEW_FRAME = DocPath.create("overview-frame.html");
|
||||
|
||||
|
@ -28,6 +28,7 @@ package jdk.javadoc.internal.doclets.toolkit.util;
|
||||
import java.util.*;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
@ -148,6 +149,9 @@ public class IndexBuilder {
|
||||
putMembersInIndexMap(aClass);
|
||||
}
|
||||
}
|
||||
if (configuration.showModules) {
|
||||
addModulesToIndexMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,6 +193,22 @@ public class IndexBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all the modules to index map.
|
||||
*/
|
||||
protected void addModulesToIndexMap() {
|
||||
for (ModuleElement mdle : configuration.modules) {
|
||||
String mdleName = mdle.getSimpleName().toString();
|
||||
char ch = (mdleName.length() == 0)
|
||||
? '*'
|
||||
: Character.toUpperCase(mdleName.charAt(0));
|
||||
Character unicode = ch;
|
||||
SortedSet<Element> list = indexmap.computeIfAbsent(unicode,
|
||||
c -> new TreeSet<>(comparator));
|
||||
list.add(mdle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Should this element be added to the index map?
|
||||
*/
|
||||
|
@ -380,6 +380,10 @@ public class Utils {
|
||||
return e.getKind() == METHOD;
|
||||
}
|
||||
|
||||
public boolean isModule(Element e) {
|
||||
return e.getKind() == ElementKind.MODULE;
|
||||
}
|
||||
|
||||
public boolean isPackage(Element e) {
|
||||
return e.getKind() == ElementKind.PACKAGE;
|
||||
}
|
||||
@ -1726,9 +1730,10 @@ public class Utils {
|
||||
|
||||
/**
|
||||
* Returns a Comparator for index file presentations, and are sorted as follows.
|
||||
* If comparing packages then simply compare the qualified names, otherwise
|
||||
* 1. sort on simple names of entities
|
||||
* 2. if equal, then compare the ElementKind ex: Package, Interface etc.
|
||||
* If comparing modules then simply compare the simple names,
|
||||
* comparing packages then simply compare the qualified names, otherwise
|
||||
* 1. if equal, then compare the ElementKind ex: Module, Package, Interface etc.
|
||||
* 2. sort on simple names of entities
|
||||
* 3a. if equal and if the type is of ExecutableElement(Constructor, Methods),
|
||||
* a case insensitive comparison of parameter the type signatures
|
||||
* 3b. if equal, case sensitive comparison of the type signatures
|
||||
@ -1739,9 +1744,10 @@ public class Utils {
|
||||
public Comparator<Element> makeIndexUseComparator() {
|
||||
return new Utils.ElementComparator<Element>() {
|
||||
/**
|
||||
* Compare two given elements, if comparing two packages, return the
|
||||
* comparison of FullyQualifiedName, first sort on names, then on the
|
||||
* kinds, then on the parameters only if the type is an ExecutableElement,
|
||||
* Compare two given elements, if comparing two modules, return the
|
||||
* comparison of SimpleName, if comparing two packages, return the
|
||||
* comparison of FullyQualifiedName, first sort on kinds, then on the
|
||||
* names, then on the parameters only if the type is an ExecutableElement,
|
||||
* the parameters are compared and finally the qualified names.
|
||||
*
|
||||
* @param e1 - an element.
|
||||
@ -1752,14 +1758,17 @@ public class Utils {
|
||||
@Override
|
||||
public int compare(Element e1, Element e2) {
|
||||
int result = 0;
|
||||
if (isModule(e1) && isModule(e2)) {
|
||||
return compareNames(e1, e2);
|
||||
}
|
||||
if (isPackage(e1) && isPackage(e2)) {
|
||||
return compareFullyQualifiedNames(e1, e2);
|
||||
}
|
||||
result = compareNames(e1, e2);
|
||||
result = compareElementTypeKinds(e1, e2);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
result = compareElementTypeKinds(e1, e2);
|
||||
result = compareNames(e1, e2);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
@ -1945,15 +1954,16 @@ public class Utils {
|
||||
final EnumMap<ElementKind, Integer> elementKindOrder;
|
||||
public ElementComparator() {
|
||||
elementKindOrder = new EnumMap<>(ElementKind.class);
|
||||
elementKindOrder.put(ElementKind.PACKAGE, 0);
|
||||
elementKindOrder.put(ElementKind.CLASS, 1);
|
||||
elementKindOrder.put(ElementKind.ENUM, 2);
|
||||
elementKindOrder.put(ElementKind.ENUM_CONSTANT, 3);
|
||||
elementKindOrder.put(ElementKind.INTERFACE, 4);
|
||||
elementKindOrder.put(ElementKind.ANNOTATION_TYPE, 5);
|
||||
elementKindOrder.put(ElementKind.FIELD, 6);
|
||||
elementKindOrder.put(ElementKind.CONSTRUCTOR, 7);
|
||||
elementKindOrder.put(ElementKind.METHOD, 8);
|
||||
elementKindOrder.put(ElementKind.MODULE, 0);
|
||||
elementKindOrder.put(ElementKind.PACKAGE, 1);
|
||||
elementKindOrder.put(ElementKind.CLASS, 2);
|
||||
elementKindOrder.put(ElementKind.ENUM, 3);
|
||||
elementKindOrder.put(ElementKind.ENUM_CONSTANT, 4);
|
||||
elementKindOrder.put(ElementKind.INTERFACE, 5);
|
||||
elementKindOrder.put(ElementKind.ANNOTATION_TYPE, 6);
|
||||
elementKindOrder.put(ElementKind.FIELD, 7);
|
||||
elementKindOrder.put(ElementKind.CONSTRUCTOR, 8);
|
||||
elementKindOrder.put(ElementKind.METHOD, 9);
|
||||
}
|
||||
|
||||
protected int compareParameters(boolean caseSensitive, List<? extends VariableElement> params1,
|
||||
@ -2377,6 +2387,11 @@ public class Utils {
|
||||
private String getSimpleName0(Element e) {
|
||||
if (snvisitor == null) {
|
||||
snvisitor = new SimpleElementVisitor9<String, Void>() {
|
||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||
public String visitModule(ModuleElement e, Void p) {
|
||||
return e.getSimpleName().toString();
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||
public String visitType(TypeElement e, Void p) {
|
||||
StringBuilder sb = new StringBuilder(e.getSimpleName());
|
||||
@ -2981,6 +2996,10 @@ public class Utils {
|
||||
return out;
|
||||
}
|
||||
|
||||
public ModuleElement containingModule(Element e) {
|
||||
return elementUtils.getModuleOf(e);
|
||||
}
|
||||
|
||||
public PackageElement containingPackage(Element e) {
|
||||
return elementUtils.getPackageOf(e);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291
|
||||
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995
|
||||
* @summary Test modules support in javadoc.
|
||||
* @author bpatel
|
||||
* @library ../lib
|
||||
@ -55,6 +55,7 @@ public class TestModules extends JavadocTester {
|
||||
checkModuleClickThroughLinks();
|
||||
checkModuleClickThrough(true);
|
||||
checkModuleFilesAndLinks(true);
|
||||
checkModulesInSearch(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,6 +75,7 @@ public class TestModules extends JavadocTester {
|
||||
checkModuleClickThroughLinks();
|
||||
checkModuleClickThrough(true);
|
||||
checkModuleFilesAndLinks(true);
|
||||
checkModulesInSearch(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,6 +122,7 @@ public class TestModules extends JavadocTester {
|
||||
checkOverviewSummaryPackages();
|
||||
checkModuleClickThrough(false);
|
||||
checkModuleFilesAndLinks(false);
|
||||
checkModulesInSearch(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,6 +136,7 @@ public class TestModules extends JavadocTester {
|
||||
checkExit(Exit.OK);
|
||||
checkHtml5OverviewSummaryPackages();
|
||||
checkModuleFilesAndLinks(false);
|
||||
checkModulesInSearch(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,13 +187,15 @@ public class TestModules extends JavadocTester {
|
||||
+ "<a name=\"module.description\">\n"
|
||||
+ "<!-- -->\n"
|
||||
+ "</a>\n"
|
||||
+ "<div class=\"block\">This is a test description for the module1 module.</div>");
|
||||
+ "<div class=\"block\">This is a test description for the module1 module. Search "
|
||||
+ "phrase <a id=\"searchphrase\">search phrase</a>.</div>");
|
||||
checkOutput("module2-summary.html", found,
|
||||
"<!-- ============ MODULE DESCRIPTION =========== -->\n"
|
||||
+ "<a name=\"module.description\">\n"
|
||||
+ "<!-- -->\n"
|
||||
+ "</a>\n"
|
||||
+ "<div class=\"block\">This is a test description for the module2 module.</div>");
|
||||
+ "<div class=\"block\">This is a test description for the module2 module. Search "
|
||||
+ "word <a id=\"search_word\">search_word</a> with no description.</div>");
|
||||
}
|
||||
|
||||
void checkNoDescription(boolean found) {
|
||||
@ -216,16 +222,16 @@ public class TestModules extends JavadocTester {
|
||||
+ "<a id=\"module.description\">\n"
|
||||
+ "<!-- -->\n"
|
||||
+ "</a>\n"
|
||||
+ "<div class=\"block\">This is a test description for the module1 module.</div>\n"
|
||||
+ "</section>");
|
||||
+ "<div class=\"block\">This is a test description for the module1 module. Search "
|
||||
+ "phrase <a id=\"searchphrase\">search phrase</a>.</div>");
|
||||
checkOutput("module2-summary.html", found,
|
||||
"<section role=\"region\">\n"
|
||||
+ "<!-- ============ MODULE DESCRIPTION =========== -->\n"
|
||||
+ "<a id=\"module.description\">\n"
|
||||
+ "<!-- -->\n"
|
||||
+ "</a>\n"
|
||||
+ "<div class=\"block\">This is a test description for the module2 module.</div>\n"
|
||||
+ "</section>");
|
||||
+ "<div class=\"block\">This is a test description for the module2 module. Search "
|
||||
+ "word <a id=\"search_word\">search_word</a> with no description.</div>");
|
||||
}
|
||||
|
||||
void checkHtml5NoDescription(boolean found) {
|
||||
@ -527,4 +533,27 @@ public class TestModules extends JavadocTester {
|
||||
"module1-summary.html",
|
||||
"module-overview-frame.html");
|
||||
}
|
||||
|
||||
void checkModulesInSearch(boolean found) {
|
||||
checkOutput("index-all.html", found,
|
||||
"<dl>\n"
|
||||
+ "<dt><a href=\"module1-summary.html\">module1</a> - module module1</dt>\n"
|
||||
+ "<dd>\n"
|
||||
+ "<div class=\"block\">This is a test description for the module1 module.</div>\n"
|
||||
+ "</dd>\n"
|
||||
+ "<dt><a href=\"module2-summary.html\">module2</a> - module module2</dt>\n"
|
||||
+ "<dd>\n"
|
||||
+ "<div class=\"block\">This is a test description for the module2 module.</div>\n"
|
||||
+ "</dd>\n"
|
||||
+ "</dl>");
|
||||
checkOutput("index-all.html", found,
|
||||
"<dl>\n"
|
||||
+ "<dt><span class=\"searchTagLink\"><a href=\"module1-summary.html#searchphrase\">"
|
||||
+ "search phrase</a></span> - Search tag in module1</dt>\n"
|
||||
+ "<dd>with description</dd>\n"
|
||||
+ "<dt><span class=\"searchTagLink\"><a href=\"module2-summary.html#search_word\">"
|
||||
+ "search_word</a></span> - Search tag in module2</dt>\n"
|
||||
+ "<dd> </dd>\n"
|
||||
+ "</dl>");
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is a test description for the module1 module.
|
||||
* This is a test description for the module1 module. Search phrase {@index "search phrase" with description}.
|
||||
*/
|
||||
module module1 {
|
||||
requires module2;
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is a test description for the module2 module.
|
||||
* This is a test description for the module2 module. Search word {@index search_word} with no description.
|
||||
*/
|
||||
module module2 {
|
||||
exports testpkgmdl2;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8039410 8042601 8042829 8049393 8050031 8155061
|
||||
* @bug 8039410 8042601 8042829 8049393 8050031 8155061 8155995
|
||||
* @summary test to determine if members are ordered correctly
|
||||
* @author ksrini
|
||||
* @library ../lib/
|
||||
@ -179,10 +179,27 @@ public class TestOrdering extends JavadocTester {
|
||||
"something()</a></span> - Method in class a.<a href=\"a/something.html\"",
|
||||
"something()</a></span> - Method in class something.<a href=\"something/J.html\""
|
||||
};
|
||||
|
||||
String[] composeTestVectors() {
|
||||
List<String> testList = new ArrayList<>();
|
||||
|
||||
testList.addAll(Arrays.asList(expectedPackageOrdering));
|
||||
for (String x : expectedEnumOrdering) {
|
||||
testList.add(x.replace("REPLACE_ME", "<Unnamed>"));
|
||||
for (int i = 0; i < MAX_PACKAGES; i++) {
|
||||
String wpkg = "add" + i;
|
||||
testList.add(wpkg + "/" + x.replace("REPLACE_ME",
|
||||
wpkg));
|
||||
String dpkg = wpkg;
|
||||
for (int j = 1; j < MAX_SUBPACKAGES_DEPTH; j++) {
|
||||
dpkg = dpkg + "/" + "add";
|
||||
testList.add(dpkg + "/" + x.replace("REPLACE_ME",
|
||||
pathToPackage(dpkg)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
testList.addAll(Arrays.asList(expectedFieldOrdering));
|
||||
|
||||
for (String x : expectedMethodOrdering) {
|
||||
testList.add(x);
|
||||
@ -197,21 +214,6 @@ public class TestOrdering extends JavadocTester {
|
||||
}
|
||||
}
|
||||
|
||||
for (String x : expectedEnumOrdering) {
|
||||
testList.add(x.replace("REPLACE_ME", "<Unnamed>"));
|
||||
for (int i = 0; i < MAX_PACKAGES; i++) {
|
||||
String wpkg = "add" + i;
|
||||
testList.add(wpkg + "/" + x.replace("REPLACE_ME", wpkg));
|
||||
String dpkg = wpkg;
|
||||
for (int j = 1; j < MAX_SUBPACKAGES_DEPTH; j++) {
|
||||
dpkg = dpkg + "/" + "add";
|
||||
testList.add(dpkg + "/" + x.replace("REPLACE_ME", pathToPackage(dpkg)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
testList.addAll(Arrays.asList(expectedFieldOrdering));
|
||||
|
||||
return testList.toArray(new String[testList.size()]);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user