8345555: Improve layout of search results

Reviewed-by: liach, nbenalla
This commit is contained in:
Hannes Wallnöfer 2025-03-17 09:00:50 +00:00
parent e29d405504
commit c8913d2c9c
33 changed files with 945 additions and 528 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2025, 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
@ -1882,7 +1882,7 @@ public abstract class HtmlDocletWriter {
String tagText = headingContent.replaceAll("\\s+", " ");
IndexItem item = IndexItem.of(element, node, tagText,
getTagletWriterInstance(context).getHolderName(element),
resources.getText("doclet.Section"),
"",
new DocLink(path, id));
configuration.indexBuilder.add(item);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2025, 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
@ -200,9 +200,6 @@ public class IndexWriter extends HtmlDocletWriter {
case PACKAGE -> {
dt = HtmlTree.DT(getPackageLink((PackageElement) element, Text.of(label)));
if (configuration.showModules) {
item.setContainingModule(utils.getFullyQualifiedName(utils.containingModule(element)));
}
dt.add(" - ").add(contents.package_).add(" " + label);
}
@ -259,7 +256,14 @@ public class IndexWriter extends HtmlDocletWriter {
var labelLink = HtmlTree.A(itemPath, Text.of(item.getLabel()));
var dt = HtmlTree.DT(labelLink.setStyle(HtmlStyles.searchTagLink));
dt.add(" - ");
dt.add(contents.getContent("doclet.Search_tag_in", item.getHolder()));
var tagKindKey = switch (item.getKind()) {
case SEARCH_ITEM -> "doclet.Search_tag_in";
case SYSTEM_PROPERTY -> "doclet.System_property_in";
case SECTION -> "doclet.Section_in";
case EXTERNAL_SPEC -> "doclet.External_specification_in";
default -> throw new Error();
};
dt.add(contents.getContent(tagKindKey, item.getHolder()));
target.add(dt);
var dd = HtmlTree.DD();
if (item.getDescription().isEmpty()) {

View File

@ -39,6 +39,8 @@ import jdk.javadoc.internal.html.HtmlTag;
import jdk.javadoc.internal.html.HtmlTree;
import jdk.javadoc.internal.html.Text;
import javax.lang.model.element.ModuleElement;
/**
* Generates the search landing page for the generated API documentation.
*/
@ -70,16 +72,8 @@ public class SearchWriter extends HtmlDocletWriter {
*/
protected void addSearchFileContents(Content contentTree) {
String copyText = resources.getText("doclet.Copy_to_clipboard");
String copiedText = resources.getText("doclet.Copied_to_clipboard");
String copyUrlText = resources.getText("doclet.Copy_url_to_clipboard");
Content helpSection = Text.EMPTY;
// Suppress link to help page if no help page is generated or a custom help page is used.
HtmlOptions options = configuration.getOptions();
if (!options.noHelp() && options.helpFile().isEmpty()) {
Content helpLink = HtmlTree.A("help-doc.html#search", contents.getContent("doclet.search.help_page_link"));
helpSection = HtmlTree.P(contents.getContent("doclet.search.help_page_info", helpLink));
}
var moduleSelector = createModuleSelector();
var resourceSection = createResourceSection();
contentTree.add(HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyles.title,
contents.getContent("doclet.search.main_heading")))
@ -89,31 +83,13 @@ public class SearchWriter extends HtmlDocletWriter {
.put(HtmlAttr.AUTOCOMPLETE, "off")
.put(HtmlAttr.SPELLCHECK, "false"))
.add(HtmlTree.INPUT(HtmlAttr.InputType.RESET, HtmlId.of("page-search-reset"))
.put(HtmlAttr.VALUE, resources.getText("doclet.search_reset"))
.put(HtmlAttr.STYLE, "margin: 6px;"))
.put(HtmlAttr.TABINDEX, "-1")
.put(HtmlAttr.VALUE, resources.getText("doclet.search_reset")))
.add(moduleSelector)
.add(HtmlTree.DETAILS(HtmlStyles.pageSearchDetails)
.add(HtmlTree.SUMMARY(contents.getContent("doclet.search.show_more"))
.setId(HtmlId.of("page-search-expand")))))
.add(HtmlTree.DIV(HtmlStyles.pageSearchInfo, helpSection)
.add(HtmlTree.P(contents.getContent("doclet.search.keyboard_info",
HtmlTree.KBD(Text.of("Ctrl")), HtmlTree.KBD(Text.of("Cmd")),
new ContentBuilder(HtmlTree.KBD(Entity.of("leftarrow")), Text.of("/"),
HtmlTree.KBD(Entity.of("rightarrow"))))))
.add(HtmlTree.P(contents.getContent("doclet.search.browser_info")))
.add(HtmlTree.SPAN(Text.of("link"))
.setId(HtmlId.of("page-search-link")))
.add(HtmlTree.BUTTON(HtmlId.of("page-search-copy"))
.add(HtmlTree.of(HtmlTag.IMG)
.put(HtmlAttr.SRC, pathToRoot.resolve(DocPaths.RESOURCE_FILES)
.resolve(DocPaths.CLIPBOARD_SVG).getPath())
.put(HtmlAttr.ALT, copyUrlText))
.add(HtmlTree.SPAN(Text.of(copyText))
.put(HtmlAttr.DATA_COPIED, copiedText))
.addStyle(HtmlStyles.copy)
.put(HtmlAttr.ARIA_LABEL, copyUrlText))
.add(HtmlTree.P(HtmlTree.INPUT(HtmlAttr.InputType.CHECKBOX, HtmlId.of("search-redirect")))
.add(HtmlTree.LABEL("search-redirect",
contents.getContent("doclet.search.redirect")))))
.add(resourceSection)
.add(HtmlTree.P(contents.getContent("doclet.search.loading"))
.setId(HtmlId.of("page-search-notify")))
.add(HtmlTree.DIV(HtmlTree.DIV(HtmlId.of("result-container"))
@ -123,4 +99,61 @@ public class SearchWriter extends HtmlDocletWriter {
.add(HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.SCRIPT_FILES)
.resolve(DocPaths.SEARCH_PAGE_JS).getPath())));
}
private Content createModuleSelector() {
if (!configuration.showModules) {
return Text.EMPTY;
}
var select = HtmlTree.of(HtmlTag.SELECT)
.setId(HtmlId.of("search-modules"))
.add(HtmlTree.of(HtmlTag.OPTION)
.put(HtmlAttr.VALUE, "")
.add(contents.getContent("doclet.search.all_modules")));
for (ModuleElement module : configuration.modules) {
select.add(HtmlTree.of(HtmlTag.OPTION)
.put(HtmlAttr.VALUE, module.getQualifiedName().toString())
.add(Text.of(module.getQualifiedName().toString())));
}
return new ContentBuilder(contents.getContent("doclet.search.in", select));
}
private Content createResourceSection() {
String copyText = resources.getText("doclet.Copy_to_clipboard");
String copiedText = resources.getText("doclet.Copied_to_clipboard");
String copyUrlText = resources.getText("doclet.Copy_url_to_clipboard");
Content helpSection = Text.EMPTY;
// Suppress link to help page if no help page is generated or a custom help page is used.
HtmlOptions options = configuration.getOptions();
if (!options.noHelp() && options.helpFile().isEmpty()) {
Content helpLink = HtmlTree.A("help-doc.html#search", contents.getContent("doclet.search.help_page_link"));
helpSection = HtmlTree.P(contents.getContent("doclet.search.help_page_info", helpLink));
}
return HtmlTree.DIV(HtmlStyles.pageSearchInfo, helpSection)
.add(HtmlTree.P(contents.getContent("doclet.search.keyboard_info",
HtmlTree.KBD(Entity.of("downarrow")), HtmlTree.KBD(Entity.of("uparrow")),
new ContentBuilder(HtmlTree.KBD(Entity.of("leftarrow")), Text.of("/"),
HtmlTree.KBD(Entity.of("rightarrow"))))))
.add(HtmlTree.P(contents.getContent("doclet.search.browser_info")))
.add(HtmlTree.SPAN(Text.of("link"))
.setId(HtmlId.of("page-search-link")))
.add(HtmlTree.BUTTON(HtmlId.of("page-search-copy"))
.add(HtmlTree.of(HtmlTag.IMG)
.put(HtmlAttr.SRC, pathToRoot.resolve(DocPaths.RESOURCE_FILES)
.resolve(DocPaths.CLIPBOARD_SVG).getPath())
.put(HtmlAttr.ALT, copyUrlText))
.add(HtmlTree.SPAN(Text.of(copyText))
.put(HtmlAttr.DATA_COPIED, copiedText))
.addStyle(HtmlStyles.copy)
.put(HtmlAttr.ARIA_LABEL, copyUrlText))
.add(HtmlTree.P(HtmlTree.INPUT(HtmlAttr.InputType.CHECKBOX, HtmlId.of("search-redirect")))
.add(HtmlTree.LABEL("search-redirect",
contents.getContent("doclet.search.redirect"))));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
@ -24,32 +24,35 @@ $(function() {
copyToClipboard(this.previousSibling.innerText);
switchCopyLabel(this, this.lastElementChild);
}
copy.click(copyLink);
copy.on("click", copyLink);
copy[0].onmouseenter = function() {};
redirect.click(setSearchUrlTemplate);
redirect.on("click", setSearchUrlTemplate);
setSearchUrlTemplate();
copy.prop("disabled", false);
redirect.prop("disabled", false);
expand.click(function (e) {
expand.on("click", function (e) {
var searchInfo = $("div.page-search-info");
if(this.parentElement.hasAttribute("open")) {
searchInfo.attr("style", "border-width: 0;");
searchInfo.attr("style", " display:none;");
} else {
searchInfo.attr("style", "border-width: 1px;").height(searchInfo.prop("scrollHeight"));
searchInfo.attr("style", "display:block;");
}
});
});
$(window).on("load", function() {
var input = $("#page-search-input");
var reset = $("#page-search-reset");
var modules = $("#search-modules");
var notify = $("#page-search-notify");
var resultSection = $("div#result-section");
var resultContainer = $("div#result-container");
var selectedLink;
var searchTerm = "";
var activeTab = "";
var fixedTab = false;
var visibleTabs = [];
var feelingLucky = false;
const MIN_TABBED_RESULTS = 10;
function renderResults(result) {
if (!result.length) {
notify.html(messages.noResult);
@ -71,14 +74,8 @@ $(window).on("load", function() {
var arr = r[item.category];
arr.push(item);
}
if (!activeTab || r[activeTab].length === 0 || !fixedTab) {
Object.keys(r).reduce(function(prev, curr) {
if (r[curr].length > 0 && r[curr][0].score > prev) {
activeTab = curr;
return r[curr][0].score;
}
return prev;
}, 0);
if (!activeTab || r[activeTab].length === 0) {
activeTab = Object.keys(r).find(category => r[category].length > 0);
}
if (feelingLucky && activeTab) {
notify.html(messages.redirecting)
@ -86,13 +83,11 @@ $(window).on("load", function() {
window.location = getURL(firstItem.indexItem, firstItem.category);
return;
}
if (result.length > 20) {
if (searchTerm[searchTerm.length - 1] === ".") {
if (activeTab === "types" && r["members"].length > r["types"].length) {
activeTab = "members";
} else if (activeTab === "packages" && r["types"].length > r["packages"].length) {
activeTab = "types";
}
if (searchTerm.endsWith(".") && result.length > MIN_TABBED_RESULTS) {
if (activeTab === "types" && r["members"].length > r["types"].length) {
activeTab = "members";
} else if (activeTab === "packages" && r["types"].length > r["packages"].length) {
activeTab = "types";
}
}
var categoryCount = Object.keys(r).reduce(function(prev, curr) {
@ -104,87 +99,94 @@ $(window).on("load", function() {
var id = "#result-tab-" + key.replace("searchTags", "search_tags");
if (r[key].length) {
var count = r[key].length >= 1000 ? "999+" : r[key].length;
if (result.length > 20 && categoryCount > 1) {
var button = $("<button id='result-tab-" + key
+ "' class='page-search-header'><span>" + categories[key] + "</span>"
+ "<span style='font-weight: normal'> (" + count + ")</span></button>").appendTo(tabContainer);
button.click(key, function(e) {
fixedTab = true;
renderResult(e.data, $(this));
});
if (result.length > MIN_TABBED_RESULTS && categoryCount > 1) {
let button = $("<button/>")
.attr("id", "result-tab-" + key)
.attr("tabIndex", "-1")
.addClass("page-search-header")
.append($("<span/>")
.html(categories[key])
.append($("<span/>")
.attr("style", "font-weight:normal;")
.html(" (" + count + ")")))
.on("click", null, key, function(e) {
fixedTab = true;
renderResult(e.data, $(this));
}).appendTo(tabContainer);
visibleTabs.push(key);
} else {
$("<span class='page-search-header'>" + categories[key]
+ "<span style='font-weight: normal'> (" + count + ")</span></span>").appendTo(tabContainer);
renderTable(key, r[key]).appendTo(resultContainer);
tabContainer = $("<div class='table-tabs'></div>").appendTo(resultContainer);
}
}
}
if (activeTab && result.length > 20 && categoryCount > 1) {
$("button#result-tab-" + activeTab).addClass("active-table-tab");
if (activeTab && result.length > MIN_TABBED_RESULTS && categoryCount > 1) {
$("button#result-tab-" + activeTab).addClass("active-table-tab").attr("tabIndex", "0");
renderTable(activeTab, r[activeTab]).appendTo(resultContainer);
}
resultSection.show();
function renderResult(category, button) {
activeTab = category;
setSearchUrl();
resultContainer.find("div.summary-table").remove();
resultContainer.find("div.result-table").remove();
renderTable(activeTab, r[activeTab]).appendTo(resultContainer);
button.siblings().removeClass("active-table-tab");
button.addClass("active-table-tab");
button.siblings().removeClass("active-table-tab").attr("tabIndex", "-1");
button.addClass("active-table-tab").attr("tabIndex", "0");
}
}
function selectTab(category) {
$("button#result-tab-" + category).click();
$("button#result-tab-" + category).focus().trigger("click");
}
function renderTable(category, items) {
var table = $("<div class='summary-table'>")
.addClass(category === "modules"
? "one-column-search-results"
: "two-column-search-results");
var table = $("<div class='result-table'>");
var col1, col2;
if (category === "modules") {
col1 = "Module";
col1 = mdlDesc;
} else if (category === "packages") {
col1 = "Module";
col2 = "Package";
col1 = pkgDesc;
} else if (category === "types") {
col1 = "Package";
col2 = "Class"
col1 = clsDesc;
} else if (category === "members") {
col1 = "Class";
col2 = "Member";
col1 = mbrDesc;
} else if (category === "searchTags") {
col1 = "Location";
col2 = "Name";
}
$("<div class='table-header col-plain'>" + col1 + "</div>").appendTo(table);
if (category !== "modules") {
$("<div class='table-header col-plain'>" + col2 + "</div>").appendTo(table);
col1 = tagDesc;
}
col2 = descDesc;
$("<div class='table-header'/>")
.append($("<span class='table-header'/>").html(col1))
.append($("<span class='table-header'/>").html(col2))
.appendTo(table);
$.each(items, function(index, item) {
var rowColor = index % 2 ? "odd-row-color" : "even-row-color";
renderItem(item, table, rowColor);
renderItem(item, table);
});
return table;
}
function renderItem(item, table, rowColor) {
var label = getHighlightedText(item.input, item.boundaries, item.prefix.length, item.input.length);
function select() {
if (!this.classList.contains("selected")) {
setSelected(this);
}
}
function unselect() {
if (this.classList.contains("selected")) {
setSelected(null);
}
}
function renderItem(item, table) {
var label = getResultLabel(item);
var desc = getResultDescription(item);
var link = $("<a/>")
.attr("href", getURL(item.indexItem, item.category))
.attr("tabindex", "0")
.addClass("search-result-link")
.html(label);
var container = getHighlightedText(item.input, item.boundaries, 0, item.prefix.length - 1);
if (item.category === "searchTags") {
container = item.indexItem.h || "";
}
if (item.category !== "modules") {
$("<div/>").html(container).addClass("col-plain").addClass(rowColor).appendTo(table);
}
$("<div/>").html(link).addClass("col-last").addClass(rowColor).appendTo(table);
.addClass("search-result-link");
link.on("mousemove", select.bind(link[0]))
.on("focus", select.bind(link[0]))
.on("mouseleave", unselect.bind(link[0]))
.on("blur", unselect.bind(link[0]))
.append($("<span/>").addClass("search-result-label").html(label))
.append($("<span/>").addClass("search-result-desc").html(desc))
.appendTo(table);
}
var timeout;
function schedulePageSearch() {
@ -206,7 +208,8 @@ $(window).on("load", function() {
resultSection.hide();
} else {
notify.html(messages.searching);
doSearch({ term: term, maxResults: 1200 }, renderResults);
var module = modules.val();
doSearch({ term: term, maxResults: 1200, module: module}, renderResults);
}
}
function setSearchUrl() {
@ -217,24 +220,81 @@ $(window).on("load", function() {
if (activeTab && fixedTab) {
url += "&c=" + activeTab;
}
if (modules.val()) {
url += "&m=" + modules.val();
}
}
history.replaceState({query: query}, "", url);
}
input.on("input", function(e) {
feelingLucky = false;
reset.css("visibility", input.val() ? "visible" : "hidden");
schedulePageSearch();
});
$(document).keydown(function(e) {
if ((e.ctrlKey || e.metaKey) && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
if (activeTab && visibleTabs.length > 1) {
var idx = visibleTabs.indexOf(activeTab);
idx += e.key === "ArrowLeft" ? visibleTabs.length - 1 : 1;
selectTab(visibleTabs[idx % visibleTabs.length]);
return false;
function setSelected(link) {
if (selectedLink) {
selectedLink.classList.remove("selected");
selectedLink.blur();
}
if (link) {
link.classList.add("selected");
link.focus({focusVisible: true});
}
selectedLink = link;
}
document.addEventListener("keydown", e => {
if (e.ctrlKey || e.altKey || e.metaKey) {
return;
}
if (e.key === "Escape" && input.val()) {
input.val("").focus();
doPageSearch();
e.preventDefault();
}
if (e.target === modules[0]) {
return;
}
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
if (activeTab && visibleTabs.length > 1 && e.target !== input[0]) {
var tab = visibleTabs.indexOf(activeTab);
var newTab = e.key === "ArrowLeft"
? Math.max(0, tab - 1)
: Math.min(visibleTabs.length - 1, tab + 1);
if (newTab !== tab) {
selectTab(visibleTabs[newTab]);
}
e.preventDefault();
}
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
let links = Array.from(
document.querySelectorAll("div.result-table > a.search-result-link"));
let current = links.indexOf(selectedLink);
let activeButton = document.querySelector("button.active-table-tab");
if (e.key === "ArrowUp" || (e.key === "Tab" && e.shiftKey)) {
if (current > 0) {
setSelected(links[current - 1]);
} else {
setSelected(null);
if (activeButton && current === 0) {
activeButton.focus();
} else {
input.focus();
}
}
} else if (e.key === "ArrowDown") {
if (document.activeElement === input[0] && activeButton) {
activeButton.focus();
} else if (current < links.length - 1) {
setSelected(links[current + 1]);
}
}
e.preventDefault();
} else if (e.key.length === 1 || e.key === "Backspace") {
setSelected(null);
input.focus();
}
});
reset.click(function() {
reset.on("click", function() {
notify.html(messages.enterTerm);
resultSection.hide();
activeTab = "";
@ -243,13 +303,34 @@ $(window).on("load", function() {
input.val('').focus();
setSearchUrl();
});
modules.on("change", function() {
if (input.val()) {
doPageSearch();
}
input.focus();
try {
localStorage.setItem("search-modules", modules.val());
} catch (unsupported) {}
});
input.prop("disabled", false);
input.attr("autocapitalize", "off");
reset.prop("disabled", false);
var urlParams = new URLSearchParams(window.location.search);
if (urlParams.has("m")) {
modules.val(urlParams.get("m"));
} else {
try {
var searchModules = localStorage.getItem("search-modules");
if (searchModules) {
modules.val(searchModules);
}
} catch (unsupported) {}
}
if (urlParams.has("q")) {
input.val(urlParams.get("q"))
input.val(urlParams.get("q"));
reset.css("visibility", input.val() ? "visible" : "hidden");
}
if (urlParams.has("c")) {
activeTab = urlParams.get("c");

View File

@ -21,7 +21,42 @@ const categories = {
members: "##REPLACE:doclet.search.members##",
searchTags: "##REPLACE:doclet.search.search_tags##"
};
const highlight = "<span class='result-highlight'>$&</span>";
// Localized element descriptors must match values in enum IndexItem.Kind.
const itemDesc = [
// Members
["##REPLACE:doclet.Enum_constant_in##"],
["##REPLACE:doclet.Variable_in##"],
["##REPLACE:doclet.Static_variable_in##"],
["##REPLACE:doclet.Constructor_for##"],
["##REPLACE:doclet.Element_in##"],
["##REPLACE:doclet.Method_in##"],
["##REPLACE:doclet.Static_method_in##"],
["##REPLACE:doclet.Record_component_in##"],
// Types in upper and lower case
["##REPLACE:doclet.AnnotationType##", "##REPLACE:doclet.annotationtype##"],
["##REPLACE:doclet.Enum##", "##REPLACE:doclet.enum##"],
["##REPLACE:doclet.Interface##", "##REPLACE:doclet.interface##"],
["##REPLACE:doclet.RecordClass##", "##REPLACE:doclet.recordclass##"],
["##REPLACE:doclet.Class##", "##REPLACE:doclet.class##"],
["##REPLACE:doclet.ExceptionClass##", "##REPLACE:doclet.exceptionclass##"],
// Tags
["##REPLACE:doclet.Search_tag_in##"],
["##REPLACE:doclet.System_property_in##"],
["##REPLACE:doclet.Section_in##"],
["##REPLACE:doclet.External_specification_in##"],
// Other
["##REPLACE:doclet.Summary_Page##"],
];
const mbrDesc = "##REPLACE:doclet.Member##";
const clsDesc = "##REPLACE:doclet.Class##"
const pkgDesc = "##REPLACE:doclet.Package##";
const mdlDesc = "##REPLACE:doclet.Module##";
const pkgDescLower = "##REPLACE:doclet.package##";
const mdlDescLower = "##REPLACE:doclet.module##";
const tagDesc = "##REPLACE:doclet.searchTag##";
const inDesc = "##REPLACE:doclet.in##";
const descDesc = "##REPLACE:doclet.Description##";
const linkLabel = "##REPLACE:doclet.search.linkSearchPageLabel##";
const NO_MATCH = {};
const MAX_RESULTS = 300;
const UNICODE_LETTER = 0;
@ -65,6 +100,8 @@ function getURLPrefix(item, category) {
$.each(packageSearchIndex, function(index, it) {
if (it.m && item.p === it.l) {
urlPrefix = it.m + slash;
item.m = it.m;
return false;
}
});
}
@ -116,27 +153,21 @@ function createMatcher(term, camelCase) {
// ',' and '?' are the only delimiters commonly followed by space in java signatures
pattern += "(" + escapeUnicodeRegex(s).replace(/[,?]/g, "$&\\s*?") + ")";
upperCase.push(false);
var isWordToken = /[\p{L}\p{Nd}_]$/u.test(s);
if (isWordToken) {
if (i === tokens.length - 1 && index < array.length - 1) {
// space in query string matches all delimiters
pattern += "(.*?)";
upperCase.push(isUpperCase(s[0]));
} else {
if (!camelCase && isUpperCase(s) && s.length === 1) {
pattern += "()";
} else {
pattern += "([\\p{L}\\p{Nd}\\p{Sc}<>?[\\]]*?)";
}
upperCase.push(isUpperCase(s[0]));
}
if (i === tokens.length - 1 && index < array.length - 1) {
// space in query string matches all delimiters
pattern += "(.*?)";
upperCase.push(isUpperCase(s[0]));
} else {
pattern += "()";
upperCase.push(false);
if (!camelCase && isUpperCase(s) && s.length === 1) {
pattern += "()";
} else {
pattern += "([\\p{L}\\p{Nd}\\p{Sc}<>?[\\]]*?)";
}
upperCase.push(isUpperCase(s[0]));
}
}
});
var re = new RegExp(pattern, "gui");
var re = new RegExp(pattern, camelCase ? "gu" : "gui");
re.upperCase = upperCase;
return re;
}
@ -144,7 +175,7 @@ function createMatcher(term, camelCase) {
function escapeUnicodeRegex(pattern) {
return pattern.replace(/[\[\]{}()*+?.\\^$|\s]/g, '\\$&');
}
function findMatch(matcher, input, startOfName, endOfName) {
function findMatch(matcher, input, startOfName, endOfName, prefixLength) {
var from = startOfName;
matcher.lastIndex = from;
var match = matcher.exec(input);
@ -164,47 +195,64 @@ function findMatch(matcher, input, startOfName, endOfName) {
var prevEnd = -1;
for (var i = 1; i < match.length; i += 2) {
var charType = getCharType(input[start]);
var isMatcherUpper = matcher.upperCase[i];
// capturing groups come in pairs, match and non-match
boundaries.push(start, start + match[i].length);
// make sure groups are anchored on a left word boundary
var prevChar = input[start - 1] || "";
var nextChar = input[start + 1] || "";
if (start !== 0) {
// make sure group is anchored on a word boundary
if (start !== 0 && start !== startOfName) {
if (charType === UNICODE_DIGIT && getCharType(prevChar) === UNICODE_DIGIT) {
return NO_MATCH;
return NO_MATCH; // Numeric token must match at first digit
} else if (charType === UNICODE_LETTER && getCharType(prevChar) === UNICODE_LETTER) {
var isUpper = isUpperCase(input[start]);
if (isUpper && (isLowerCase(prevChar) || isLowerCase(nextChar))) {
score -= 0.1;
} else if (isMatcherUpper && start === prevEnd) {
score -= isUpper ? 0.1 : 1.0;
} else {
return NO_MATCH;
if (!isUpperCase(input[start]) || (!isLowerCase(prevChar) && !isLowerCase(nextChar))) {
// Not returning NO_MATCH below is to enable upper-case query strings
if (!matcher.upperCase[i] || start !== prevEnd) {
return NO_MATCH;
} else if (!isUpperCase(input[start])) {
score -= 1.0;
}
}
}
}
prevEnd = start + match[i].length;
start += match[i].length + match[i + 1].length;
// lower score for parts of the name that are missing
if (match[i + 1] && prevEnd < endOfName) {
score -= rateNoise(match[i + 1]);
// Lower score for unmatched parts between matches
if (match[i + 1]) {
score -= rateDistance(match[i + 1]);
}
}
// lower score if a type name contains unmatched camel-case parts
if (input[matchEnd - 1] !== "." && endOfName > matchEnd)
score -= rateNoise(input.slice(matchEnd, endOfName));
score -= rateNoise(input.slice(0, Math.max(startOfName, match.index)));
if (score <= 0) {
return NO_MATCH;
// Lower score for unmatched leading part of name
if (startOfName < match.index) {
score -= rateDistance(input.substring(startOfName, match.index));
}
return {
// Favor child or parent variety depending on whether parent is included in search
var matchIncludesContaining = match.index < startOfName;
// Lower score for unmatched trailing part of name, but exclude member listings
if (matchEnd < endOfName && input[matchEnd - 1] !== ".") {
let factor = matchIncludesContaining ? 0.1 : 0.8;
score -= rateDistance(input.substring(matchEnd, endOfName)) * factor;
}
// Lower score for unmatched prefix in member class name
if (prefixLength < match.index && prefixLength < startOfName) {
let factor = matchIncludesContaining ? 0.8 : 0.4;
score -= rateDistance(input.substring(prefixLength, Math.min(match.index, startOfName))) * factor;
}
// Rank qualified names by package name
if (prefixLength > 0) {
score -= rateDistance(input.substring(0, prefixLength)) * 0.2;
}
// Reduce score of constructors in member listings
if (matchEnd === prefixLength) {
score -= 0.1;
}
return score > 0 ? {
input: input,
score: score,
boundaries: boundaries
};
} : NO_MATCH;
}
function isLetter(s) {
return /\p{L}/u.test(s);
@ -227,14 +275,16 @@ function getCharType(s) {
return UNICODE_OTHER;
}
}
function rateNoise(str) {
return (str.match(/([.(])/g) || []).length / 5
+ (str.match(/(\p{Lu}+)/gu) || []).length / 10
+ str.length / 20;
function rateDistance(str) {
// Rate distance of string by counting word boundaries and camel-case tokens
return !str ? 0
: (str.split(/\b|(?<=[\p{Ll}_])\p{Lu}/u).length * 0.1
+ (isUpperCase(str[0]) ? 0.08 : 0));
}
function doSearch(request, response) {
var term = request.term.trim();
var maxResults = request.maxResults || MAX_RESULTS;
var module = checkUnnamed(request.module, "/");
var matcher = {
plainMatcher: createMatcher(term, false),
camelCaseMatcher: createMatcher(term, true)
@ -246,23 +296,17 @@ function doSearch(request, response) {
case "packages":
return checkUnnamed(item.m, "/");
case "types":
return checkUnnamed(item.p, ".");
case "members":
return checkUnnamed(item.p, ".") + item.c + ".";
return checkUnnamed(item.p, ".");
default:
return "";
}
}
function useQualifiedName(category) {
switch (category) {
case "packages":
return /[\s/]/.test(term);
case "types":
case "members":
return /[\s.]/.test(term);
default:
return false;
function getClassPrefix(item, category) {
if (category === "members" && (!item.k || (item.k < 8 && item.k !== "3"))) {
return item.c + ".";
}
return "";
}
function searchIndex(indexArray, category) {
var matches = [];
@ -273,34 +317,46 @@ function doSearch(request, response) {
return matches;
}
$.each(indexArray, function (i, item) {
if (module) {
var modulePrefix = getURLPrefix(item, category) || item.u;
if (modulePrefix.indexOf("/") > -1 && !modulePrefix.startsWith(module)) {
return;
}
}
var prefix = getPrefix(item, category);
var simpleName = item.l;
var qualifiedName = prefix + simpleName;
var useQualified = useQualifiedName(category);
var input = useQualified ? qualifiedName : simpleName;
var startOfName = useQualified ? prefix.length : 0;
var endOfName = category === "members" && input.indexOf("(", startOfName) > -1
? input.indexOf("(", startOfName) : input.length;
var m = findMatch(matcher.plainMatcher, input, startOfName, endOfName);
var classPrefix = getClassPrefix(item, category);
var simpleName = classPrefix + item.l;
if (item.d) {
simpleName += " - " + item.d;
}
var qualName = prefix + simpleName;
var startOfName = classPrefix.length + prefix.length;
var endOfName = category === "members" && qualName.indexOf("(", startOfName) > -1
? qualName.indexOf("(", startOfName) : qualName.length;
var m = findMatch(matcher.plainMatcher, qualName, startOfName, endOfName, prefix.length);
if (m === NO_MATCH && matcher.camelCaseMatcher) {
m = findMatch(matcher.camelCaseMatcher, input, startOfName, endOfName);
m = findMatch(matcher.camelCaseMatcher, qualName, startOfName, endOfName, prefix.length);
}
if (m !== NO_MATCH) {
m.indexItem = item;
m.prefix = prefix;
m.name = simpleName;
m.category = category;
if (!useQualified) {
m.input = qualifiedName;
if (m.boundaries[0] < prefix.length) {
m.name = qualName;
} else {
m.boundaries = m.boundaries.map(function(b) {
return b + prefix.length;
return b - prefix.length;
});
}
// m.name = m.name + " " + m.score.toFixed(3);
matches.push(m);
}
return true;
});
return matches.sort(function(e1, e2) {
return e2.score - e1.score;
return e2.score - e1.score
|| (category !== "members"
? e1.name.localeCompare(e2.name) : 0);
}).slice(0, maxResults);
}
@ -360,29 +416,91 @@ $.widget("custom.catcomplete", $.ui.autocomplete, {
}
li.attr("class", "result-item");
});
ul.append("<li class='ui-static-link'><a href='" + pathtoroot + "search.html?q="
+ encodeURI(widget.term) + "'>Go to search page</a></li>");
ul.append("<li class='ui-static-link'><div><a href='" + pathtoroot + "search.html?q="
+ encodeURI(widget.term) + "'>" + linkLabel + "</a></div></li>");
},
_renderItem: function(ul, item) {
var li = $("<li/>").appendTo(ul);
var div = $("<div/>").appendTo(li);
var label = item.l
? item.l
: getHighlightedText(item.input, item.boundaries, 0, item.input.length);
var idx = item.indexItem;
if (item.category === "searchTags" && idx && idx.h) {
if (idx.d) {
div.html(label + "<span class='search-tag-holder-result'> (" + idx.h + ")</span><br><span class='search-tag-desc-result'>"
+ idx.d + "</span><br>");
} else {
div.html(label + "<span class='search-tag-holder-result'> (" + idx.h + ")</span>");
var label = getResultLabel(item);
var resultDesc = getResultDescription(item);
return $("<li/>")
.append($("<div/>")
.append($("<span/>").addClass("search-result-label").html(label))
.append($("<span/>").addClass("search-result-desc").html(resultDesc)))
.appendTo(ul);
},
_resizeMenu: function () {
var ul = this.menu.element;
var missing = 0;
ul.children().each((i, e) => {
if (e.hasChildNodes() && e.firstChild.hasChildNodes()) {
var label = e.firstChild.firstChild;
missing = Math.max(missing, label.scrollWidth - label.clientWidth);
}
} else {
div.html(label);
}
return li;
});
ul.outerWidth( Math.max(
ul.width("").outerWidth() + missing + 40,
this.element.outerWidth()
));
}
});
function getResultLabel(item) {
if (item.l) {
return item.l;
}
return getHighlightedText(item.name, item.boundaries, 0, item.name.length);
}
function getResultDescription(item) {
if (!item.indexItem) {
return "";
}
var kind;
switch (item.category) {
case "members":
var typeName = checkUnnamed(item.indexItem.p, ".") + item.indexItem.c;
var typeDesc = getEnclosingTypeDesc(item.indexItem);
kind = itemDesc[item.indexItem.k || 5][0];
return kind.replace("{0}", typeDesc + " " + typeName);
case "types":
var pkgName = checkUnnamed(item.indexItem.p, "");
kind = itemDesc[item.indexItem.k || 12][0];
if (!pkgName) {
// Handle "All Classes" summary page and unnamed package
return item.indexItem.k === "18" ? kind : kind + " " + item.indexItem.l;
}
return getEnclosingDescription(kind, pkgDescLower, pkgName);
case "packages":
if (item.indexItem.k === "18") {
return itemDesc[item.indexItem.k][0]; // "All Packages" summary page
} else if (!item.indexItem.m) {
return pkgDesc + " " + item.indexItem.l;
}
var mdlName = item.indexItem.m;
return getEnclosingDescription(pkgDesc, mdlDescLower, mdlName);
case "modules":
return mdlDesc + " " + item.indexItem.l;
case "searchTags":
if (item.indexItem) {
var holder = item.indexItem.h;
kind = itemDesc[item.indexItem.k || 14][0];
return holder ? kind.replace("{0}", holder) : kind;
}
}
return "";
}
function getEnclosingDescription(elem, desc, label) {
return inDesc.replace("{0}", elem).replace("{1}", desc + " " + label);
}
function getEnclosingTypeDesc(item) {
if (!item.typeDesc) {
$.each(typeSearchIndex, function(index, it) {
if (it.l === item.c && it.p === item.p && it.m === item.m) {
item.typeDesc = itemDesc[it.k || 12][1];
return false;
}
});
}
return item.typeDesc || "";
}
$(function() {
var search = $("#search-input");
var reset = $("#reset-search");
@ -393,13 +511,16 @@ $(function() {
if (request.term.trim() === "") {
return this.close();
}
// Prevent selection of item at current mouse position
this.menu.previousFilter = "_";
this.menu.filterTimer = this.menu._delay(function() {
delete this.previousFilter;
}, 1000);
return doSearch(request, response);
},
response: function(event, ui) {
if (!ui.content.length) {
ui.content.push({ l: messages.noResult });
} else {
$("#search-input").empty();
}
},
autoFocus: true,
@ -413,6 +534,7 @@ $(function() {
if (ui.item.indexItem) {
var url = getURL(ui.item.indexItem, ui.item.category);
window.location.href = pathtoroot + url;
search.blur();
}
}
});

View File

@ -97,6 +97,9 @@ doclet.Record_component_in=Record component of {0}
doclet.Static_method_in=Static method in {0}
doclet.Search_tag_in=Search tag in {0}
doclet.Method_in=Method in {0}
doclet.System_property_in=System property in {0}
doclet.External_specification_in=External specification in {0}
doclet.Section_in=Section in {0}
doclet.module=module
doclet.package=package
doclet.MalformedURL=Malformed URL: {0}
@ -176,13 +179,11 @@ doclet.Enclosing_Interface=Enclosing interface:
doclet.Inheritance_Tree=Inheritance Tree
doclet.DefinedIn=Defined In
doclet.ReferencedIn=Referenced In
doclet.Section=Section
doclet.External_Specification=External Specification
doclet.External_Specifications=External Specifications
doclet.External_Specifications.All_Specifications=All Specifications
doclet.External_Specifications.no-host=Local
doclet.Specification=Specification
doclet.System_Property=System Property
doclet.Summary_Page=Summary Page
doclet.systemProperties=System Properties
doclet.systemPropertiesSummary=System Properties Summary
doclet.Window_Source_title=Source code
@ -198,15 +199,13 @@ doclet.search.help_page_link=help page
# 0: a link to the help page with text above
doclet.search.help_page_info= \
The {0} provides an introduction to the scope and syntax of JavaDoc search.
# 0: [Ctrl] 1: [Cmd] 2: [<]/[>] (left and right arrow keys)
# 0: [V] 1: [^] 2: [<]/[>] (down, up, left and right arrow keys)
doclet.search.keyboard_info= \
You can use the {0} or {1} key in combination with the {2} arrow \
keys to switch between result tabs in this page while searching.
Use the {0}/{1} keys to move between search results and the {2} keys to \
switch between result tabs.
doclet.search.browser_info= \
The URL template below may be used to configure this page as a search engine \
in browsers that support this feature. It has been tested to work in Google \
Chrome and Mozilla Firefox. Note that other browsers may not support this \
feature or require a different URL format.
The URL template below may be useful to configure this page as a search engine \
or bookmarklet in browsers that support this feature.
doclet.search.redirect=Redirect to first result
# 0: a date

View File

@ -615,6 +615,9 @@ ul.preview-feature-list {
padding:0.1em;
line-height: 1.6;
}
ul.preview-feature-list input {
margin-right: 8px;
}
/*
* Styles for tables.
*/
@ -701,7 +704,7 @@ div.checkboxes > label {
white-space: nowrap;
}
div.checkboxes > label > input {
margin: 0 2px;
margin: 0 6px 0 2px;
}
.two-column-summary {
display: grid;
@ -948,15 +951,15 @@ main, nav, header, footer, section {
.ui-autocomplete-category {
font-weight:bold;
font-size:15px;
padding:7px 0 7px 3px;
padding:7px 8px;
background-color:var(--navbar-background-color);
color:var(--navbar-text-color);
box-sizing: border-box;
}
.ui-autocomplete {
max-height:85%;
max-width:65%;
overflow:auto;
max-height:calc(98vh - var(--nav-height));
max-width:min(75vw, calc(var(--max-content-width) * 0.748));
overflow-y:auto;
white-space:nowrap;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
overscroll-behavior: contain;
@ -980,7 +983,7 @@ ul.ui-autocomplete li.ui-static-link {
padding: 5px 0;
font-family: var(--body-font-family);
font-size: 0.93em;
font-weight: bolder;
font-weight: bold;
z-index: 10;
}
li.ui-static-link a, li.ui-static-link a:visited {
@ -989,19 +992,50 @@ li.ui-static-link a, li.ui-static-link a:visited {
float:right;
margin-right:20px;
}
.ui-autocomplete .result-item {
font-size: inherit;
.ui-autocomplete > li.result-item:nth-child(even) {
background-color: var(--even-row-color)
}
.ui-autocomplete > li.result-item:nth-child(odd) {
background-color: var(--odd-row-color)
}
.ui-autocomplete {
display: grid;
grid-template-columns: auto auto;
}
.ui-autocomplete > li,
.ui-autocomplete > li > div {
grid-column: 1 / 3;
}
.ui-autocomplete > li.result-item,
.ui-autocomplete > li.result-item > div {
display: grid;
grid-template-columns: subgrid;
}
.ui-autocomplete > li.result-item {
font-family: var(--body-font-family);
font-size: var(--body-font-size);
line-height: 1.7;
}
.ui-autocomplete .search-result-label {
padding: 1px 4px;
overflow: hidden;
text-overflow: ellipsis;
}
.ui-autocomplete .search-result-desc {
font-size: var(--nav-font-size);
padding: 2px 4px;
color: #404040;
overflow: hidden;
text-overflow: ellipsis;
}
.ui-autocomplete .result-highlight {
font-weight:bold;
}
.ui-menu .ui-menu-item-wrapper {
padding-top: 0.4em;
padding-bottom: 0.4em;
.ui-menu .ui-state-active .search-result-desc {
color: #383838;
}
.ui-menu .ui-menu-item-wrapper {
padding-top: 5px;
padding-bottom: 5px;
padding: 3px 4px;
}
input[type="text"] {
background-image:url('glass.svg');
@ -1013,6 +1047,7 @@ input[type="text"] {
border-color: var(--border-color);
border-radius: 4px;
padding-left:20px;
padding-right: 18px;
font-size: var(--nav-font-size);
height: 19px;
}
@ -1022,16 +1057,14 @@ input#page-search-input {
}
input#search-input {
width: 270px;
padding-right: 18px;
margin: 0;
}
input.filter-input {
min-width: 40px;
width: 180px;
margin: 0 -8px 0 5px;
padding-right: 18px;
}
input#reset-search, input.reset-filter {
input#reset-search, input.reset-filter, input#page-search-reset {
background-color: transparent;
background-image:url('x.svg');
background-repeat:no-repeat;
@ -1055,6 +1088,11 @@ input.reset-filter {
right: 10px;
top: 0;
}
input#page-search-reset {
position: relative;
right: 18px;
top: -5px;
}
input::placeholder {
color:var(--search-input-placeholder-color);
opacity: 1;
@ -1062,6 +1100,14 @@ input::placeholder {
input:focus::placeholder {
color: transparent;
}
select#search-modules {
margin: 0 10px 0 2px;
font-size: var(--nav-font-size);
padding: 3px 5px;
border-radius: 4px;
background: #f0f0f0;
border: 1px solid #909090;
}
kbd {
background-color: #eeeeee;
border: 1px solid #b0b0b0;
@ -1071,14 +1117,6 @@ kbd {
font-size: 0.9em;
font-weight: bold;
}
.search-tag-desc-result {
font-style:italic;
font-size:11px;
}
.search-tag-holder-result {
font-style:italic;
font-size:12px;
}
.search-tag-result:target {
background-color:var(--search-tag-highlight-color);
}
@ -1096,21 +1134,61 @@ details.page-search-details {
div#result-container {
font-size: 1em;
}
div#result-container a.search-result-link {
padding: 0;
margin: 4px 0;
width: 100%;
}
#result-container .result-highlight {
font-weight:bolder;
font-weight:bold;
}
#result-container div.result-table {
display: grid;
grid-template-columns: minmax(40%, max-content) minmax(40%, auto);
}
#result-container div.result-table > div.table-header,
#result-container div.result-table > a.search-result-link {
display: grid;
grid-template-columns: subgrid;
grid-column: 1 / 3;
margin: 0;
}
#result-container div.result-table > div.table-header > span {
padding: 5px 12px;
font-size: 0.93em;
background-color: var(--subnav-background-color);
}
#result-container div.result-table > a.search-result-link > span {
padding: 8px 12px;
}
#result-container div.result-table > a.search-result-link:nth-child(odd) {
background-color: var(--odd-row-color)
}
#result-container div.result-table > a.search-result-link:nth-child(even) {
background-color: var(--even-row-color)
}
#result-container div.result-table > a.search-result-link {
color: var(--block-text-color);
white-space: nowrap;
}
#result-container div.result-table > a.search-result-link:focus-visible,
#result-container div.result-table > a.search-result-link.selected {
background-color: var(--selected-background-color);
outline: none;
}
#result-container div.result-table > a.search-result-link .search-result-label {
overflow: hidden;
text-overflow: ellipsis;
}
#result-container div.result-table > a.search-result-link .search-result-desc {
font-size: var(--nav-font-size);
color: #404040;
overflow: hidden;
text-overflow: ellipsis;
}
.page-search-info {
background-color: var(--subnav-background-color);
border-radius: 3px;
border: 0 solid var(--border-color);
padding: 0 8px;
margin: 8px 0;
overflow: hidden;
height: 0;
display: none;
transition: all 0.2s ease;
}
div.table-tabs > button.table-tab {
@ -1524,6 +1602,27 @@ table.striped > tbody > tr > th {
transform-origin: 10% 90%;
width: 26px;
}
.ui-autocomplete {
display: block;
grid-template-columns: none;
}
.ui-autocomplete > li,
.ui-autocomplete > li > div,
.ui-autocomplete > li.result-item,
.ui-autocomplete > li.result-item > div {
grid-column: unset;
display: block;
grid-template-columns: none;
}
.ui-autocomplete > li.result-item {
line-height: 1.45;
}
.ui-autocomplete .search-result-label {
display: block;
}
.ui-autocomplete .search-result-desc {
display: block;
}
}
@media screen and (max-width: 800px) {
.about-language {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2025, 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
@ -173,7 +173,7 @@ public class SpecTaglet extends BaseTaglet implements InheritableTaglet {
Content titleWithAnchor = tagletWriter.createAnchorAndSearchIndex(holder,
searchText,
title,
resources.getText("doclet.External_Specification"),
"",
docTree);
if (specURI == null) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2025, 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
@ -62,7 +62,6 @@ public class SystemPropertyTaglet extends BaseTaglet {
*/
private Content systemPropertyTagOutput(Element element, SystemPropertyTree tag) {
String tagText = tag.getPropertyName().toString();
return HtmlTree.CODE(tagletWriter.createAnchorAndSearchIndex(element, tagText,
resources.getText("doclet.System_Property"), tag));
return HtmlTree.CODE(tagletWriter.createAnchorAndSearchIndex(element, tagText, "", tag));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, 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
@ -409,7 +409,7 @@ public class TagletWriter {
public String visitExecutable(ExecutableElement e, Void p) {
return utils.getFullyQualifiedName(utils.getEnclosingTypeElement(e))
+ "." + utils.getSimpleName(e)
+ utils.flatSignature(e, htmlWriter.getCurrentTypeElement());
+ utils.makeSignature(e, htmlWriter.getCurrentTypeElement(), false, true);
}
@Override

View File

@ -236,6 +236,7 @@ doclet.search=Search
doclet.search_placeholder=Search documentation (type /)
doclet.search_in_documentation=Search in documentation
doclet.search_reset=Reset
doclet.Member=Member
doclet.Field=Field
doclet.Property=Property
doclet.Constructor=Constructor
@ -371,12 +372,16 @@ doclet.search.many_results=Found {0} results
doclet.search.loading=Loading search index...
doclet.search.searching=Searching...
doclet.search.redirecting=Redirecting to first result...
# {0} is a select input containing all_modules message below and module names
doclet.search.in=in {0}
doclet.search.all_modules=all modules
doclet.search.modules=Modules
doclet.search.packages=Packages
doclet.search.classes_and_interfaces=Classes and Interfaces
doclet.search.types=Types
doclet.search.members=Members
doclet.search.search_tags=Search Tags
doclet.search.linkSearchPageLabel=Go to search page
doclet.snippet.contents.none=\
@snippet does not specify contents

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2025, 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
@ -89,6 +89,73 @@ public class IndexItem {
TAGS
}
/**
* The kind of index item. Index items can represent program elements,
* various doc comment tags, or other resources such as summary pages.
*
* Values in this enum must match elements in array itemDesc in
* JavaScript file search.js.template!
*/
public enum Kind {
// Members
ENUM_CONSTANT,
FIELD,
STATIC_FIELD,
CONSTRUCTOR,
ANNOTATION_ELEMENT,
METHOD,
STATIC_METHOD,
RECORD_COMPONENT,
// Types
ANNOTATION_TYPE,
ENUM,
INTERFACE,
RECORD,
CLASS,
EXCEPTION_CLASS,
// Tags
SEARCH_ITEM,
SYSTEM_PROPERTY,
SECTION,
EXTERNAL_SPEC,
// Other
SUMMARY_PAGE;
/**
* {@return the kind of index item for a program element}
*/
public static Kind ofElement(Element elem, Utils utils) {
return switch (elem.getKind()) {
case ENUM_CONSTANT -> ENUM_CONSTANT;
case FIELD -> utils.isStatic(elem) ? STATIC_FIELD : FIELD;
case CONSTRUCTOR -> CONSTRUCTOR;
case METHOD -> utils.isAnnotationInterface(elem.getEnclosingElement())
? ANNOTATION_ELEMENT
: utils.isStatic(elem) ? STATIC_METHOD : METHOD;
case RECORD_COMPONENT -> RECORD_COMPONENT;
case ANNOTATION_TYPE -> ANNOTATION_TYPE;
case ENUM -> ENUM;
case CLASS -> utils.isThrowable((TypeElement) elem) ? EXCEPTION_CLASS : CLASS;
case INTERFACE -> INTERFACE;
case RECORD -> RECORD;
default -> throw new IllegalArgumentException(elem.toString());
};
}
/**
* {@return the kind of index item for a doc comment tag}
*/
public static Kind ofDocTree(DocTree tree) {
return switch (tree.getKind()) {
case DocTree.Kind.INDEX -> SEARCH_ITEM;
case DocTree.Kind.SYSTEM_PROPERTY -> SYSTEM_PROPERTY;
case DocTree.Kind.SPEC -> EXTERNAL_SPEC;
case DocTree.Kind.START_ELEMENT -> SECTION;
default -> throw new IllegalArgumentException(tree.getKind().toString());
};
}
}
/**
* The presentation string for the item. It must be non-empty.
*/
@ -124,6 +191,11 @@ public class IndexItem {
*/
private String containingClass = "";
/**
* The kind of the item.
*/
private final Kind kind;
/**
* Creates an index item for a module element.
*
@ -133,7 +205,7 @@ public class IndexItem {
* @return the item
*/
public static IndexItem of(ModuleElement moduleElement, Utils utils) {
return new IndexItem(moduleElement, utils.getFullyQualifiedName(moduleElement));
return new IndexItem(moduleElement, utils.getFullyQualifiedName(moduleElement), null);
}
/**
@ -145,7 +217,7 @@ public class IndexItem {
* @return the item
*/
public static IndexItem of(PackageElement packageElement, Utils utils) {
return new IndexItem(packageElement, utils.getPackageName(packageElement));
return new IndexItem(packageElement, utils.getPackageName(packageElement), null);
}
/**
@ -158,7 +230,7 @@ public class IndexItem {
* @return the item
*/
public static IndexItem of(TypeElement typeElement, Utils utils) {
return new IndexItem(typeElement, utils.getSimpleName(typeElement));
return new IndexItem(typeElement, utils.getSimpleName(typeElement), Kind.ofElement(typeElement, utils));
}
/**
@ -178,9 +250,9 @@ public class IndexItem {
String name = utils.getSimpleName(member);
if (utils.isExecutableElement(member)) {
ExecutableElement ee = (ExecutableElement)member;
name += utils.flatSignature(ee, typeElement);
name += utils.makeSignature(ee, typeElement, false, true);
}
return new IndexItem(member, name) {
return new IndexItem(member, name, Kind.ofElement(member, utils)) {
@Override
public TypeElement getContainingTypeElement() {
return typeElement;
@ -205,7 +277,6 @@ public class IndexItem {
String holder, String description, DocLink link) {
Objects.requireNonNull(element);
Objects.requireNonNull(holder);
Objects.requireNonNull(description);
Objects.requireNonNull(link);
switch (docTree.getKind()) {
@ -213,7 +284,7 @@ public class IndexItem {
default -> throw new IllegalArgumentException(docTree.getKind().toString());
}
return new IndexItem(element, label, link.toString()) {
return new IndexItem(element, label, Kind.ofDocTree(docTree), link.toString()) {
@Override
public DocTree getDocTree() {
return docTree;
@ -245,11 +316,7 @@ public class IndexItem {
*/
public static IndexItem of(Category category, String label, DocPath path) {
Objects.requireNonNull(category);
return new IndexItem(null, label, path.getPath()) {
@Override
public DocTree getDocTree() {
return null;
}
return new IndexItem(null, label, Kind.SUMMARY_PAGE, path.getPath()) {
@Override
public Category getCategory() {
return category;
@ -258,14 +325,10 @@ public class IndexItem {
public String getHolder() {
return "";
}
@Override
public String getDescription() {
return "";
}
};
}
private IndexItem(Element element, String label) {
private IndexItem(Element element, String label, Kind kind) {
if (label.isEmpty()) {
throw new IllegalArgumentException();
}
@ -275,10 +338,11 @@ public class IndexItem {
this.element = element;
this.label = label;
this.kind = kind;
}
private IndexItem(Element element, String label, String url) {
this(element, label);
private IndexItem(Element element, String label, Kind kind, String url) {
this(element, label, kind);
setUrl(url);
}
@ -495,13 +559,22 @@ public class IndexItem {
}
/**
* Returns a description of the tag for this item or {@code null} if this is not a item
* for a tag for an item in a documentation tag.
* Returns the kind of this item.
*
* @return the item kind
*/
public Kind getKind() {
return kind;
}
/**
* Returns a description of the tag for this item or an empty string if no
* description is available for this item.
*
* @return the description of the tag
*/
public String getDescription() {
return null;
return "";
}
/**
@ -511,76 +584,98 @@ public class IndexItem {
*/
public String toJSON() {
// TODO: Additional processing is required, see JDK-8238495
StringBuilder item = new StringBuilder();
JSONBuilder builder = new JSONBuilder();
Category category = getCategory();
switch (category) {
case MODULES:
item.append("{")
.append("\"l\":\"").append(label).append("\"")
.append("}");
builder.append("l", label);
break;
case PACKAGES:
item.append("{");
if (!containingModule.isEmpty()) {
item.append("\"m\":\"").append(containingModule).append("\",");
builder.append("m", containingModule);
}
item.append("\"l\":\"").append(label).append("\"");
builder.append("l", label);
if (!url.isEmpty()) {
item.append(",\"u\":\"").append(url).append("\"");
builder.append("u", url);
}
if (kind != null) {
builder.append("k", kind.ordinal());
}
item.append("}");
break;
case TYPES:
item.append("{");
if (!containingPackage.isEmpty()) {
item.append("\"p\":\"").append(containingPackage).append("\",");
builder.append("p", containingPackage);
}
if (!containingModule.isEmpty()) {
item.append("\"m\":\"").append(containingModule).append("\",");
builder.append("m", containingModule);
}
item.append("\"l\":\"").append(label).append("\"");
builder.append("l", label);
if (!url.isEmpty()) {
item.append(",\"u\":\"").append(url).append("\"");
builder.append("u", url);
}
if (kind != null && kind != Kind.CLASS) {
builder.append("k", kind.ordinal());
}
item.append("}");
break;
case MEMBERS:
item.append("{");
if (!containingModule.isEmpty()) {
item.append("\"m\":\"").append(containingModule).append("\",");
builder.append("m", containingModule);
}
item.append("\"p\":\"").append(containingPackage).append("\",")
.append("\"c\":\"").append(containingClass).append("\",")
.append("\"l\":\"").append(label).append("\"");
builder.append("p", containingPackage)
.append("c", containingClass)
.append("l", label);
if (!url.isEmpty()) {
item.append(",\"u\":\"").append(url).append("\"");
builder.append("u", url);
}
if (kind != null && kind != Kind.METHOD) {
builder.append("k", kind.ordinal());
}
item.append("}");
break;
case TAGS:
String holder = getHolder();
String description = getDescription();
item.append("{")
.append("\"l\":\"").append(escapeQuotes(label)).append("\",")
.append("\"h\":\"").append(holder).append("\",");
builder.append("l", escapeQuotes(label))
.append("h", holder);
if (!description.isEmpty()) {
item.append("\"d\":\"").append(escapeQuotes(description)).append("\",");
builder.append("d", escapeQuotes(description));
}
item.append("\"u\":\"").append(escapeQuotes(url)).append("\"")
.append("}");
if (kind != null && kind != Kind.SEARCH_ITEM) {
builder.append("k", kind.ordinal());
}
builder.append("u", escapeQuotes(url));
break;
default:
throw new AssertionError("Unexpected category: " + category);
}
return item.toString();
return builder.toString();
}
private String escapeQuotes(String s) {
private static String escapeQuotes(String s) {
return s.replace("\\", "\\\\").replace("\"", "\\\"");
}
// Simple JSON object string builder class
private static class JSONBuilder {
StringBuilder b = new StringBuilder("{");
public JSONBuilder append(String name, Object value) {
if (b.length() > 1) {
b.append(",");
}
b.append("\"").append(name).append("\":\"").append(value).append("\"");
return this;
}
@Override
public String toString() {
b.append("}");
return b.toString();
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2025, 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
@ -111,6 +111,7 @@ public enum HtmlAttr {
ITEMREF(true),
ITEMSCOPE(true),
ITEMTYPE(true),
LABEL,
LANG(true),
LINK,
LONGDESC,
@ -136,6 +137,7 @@ public enum HtmlAttr {
SCHEME,
SCOPE,
SCROLLING,
SELECTED,
SHAPE,
SIZE,
SPACE,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2025, 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
@ -257,6 +257,9 @@ public enum HtmlTag {
}
},
OPTION(BlockType.OTHER, EndKind.OPTIONAL,
attrs(AttrKind.OK, HtmlAttr.LABEL, SELECTED, VALUE)),
P(BlockType.BLOCK, EndKind.OPTIONAL,
EnumSet.of(Flag.EXPECT_CONTENT),
attrs(AttrKind.HTML4, ALIGN)),
@ -285,6 +288,9 @@ public enum HtmlTag {
SCRIPT(BlockType.INLINE, EndKind.REQUIRED,
attrs(AttrKind.OK, SRC, TYPE)),
SELECT(BlockType.INLINE, EndKind.REQUIRED,
attrs(AttrKind.OK, NAME, SIZE, VALUE)),
SECTION(BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),

View File

@ -1218,7 +1218,7 @@ public class HtmlTree extends Content {
*/
public boolean isInline() {
return switch (tag) {
case A, BUTTON, BR, CODE, EM, I, IMG, LABEL, SMALL, SPAN, STRONG, SUB, SUP, WBR -> true;
case A, BUTTON, BR, CODE, EM, I, IMG, INPUT, LABEL, SELECT, SMALL, SPAN, STRONG, SUB, SUP, WBR -> true;
default -> false;
};
}

View File

@ -137,11 +137,11 @@ public class CheckStylesheetClasses {
removeAll(styleSheetNames, "borderless", "plain", "striped");
// used in search.js and search-page.js; may be worth documenting in HtmlStyle
removeAll(styleSheetNames, "result-highlight", "result-item", "anchor-link",
"search-tag-desc-result", "search-tag-holder-result", "page-search-header",
"ui-autocomplete", "ui-autocomplete-category", "ui-state-active", "ui-menu",
"ui-menu-item-wrapper", "ui-static-link", "expanded", "search-result-link",
"two-column-search-results", "sort-asc", "sort-desc", "visible");
removeAll(styleSheetNames, "result-highlight", "result-item", "anchor-link", "expanded",
"page-search-header", "result-table", "ui-autocomplete", "ui-autocomplete-category",
"ui-state-active", "ui-menu", "ui-menu-item-wrapper", "ui-static-link",
"search-result-desc", "search-result-label", "search-result-link", "selected",
"sort-asc", "sort-desc", "two-column-search-results", "visible");
// very JDK specific
styleSheetNames.remove("module-graph");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2025, 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,7 +23,7 @@
/*
* @test
* @bug 8289332 8286470 8309471
* @bug 8289332 8286470 8309471 8345555
* @summary Auto-generate ids for user-defined headings
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -140,26 +140,26 @@ public class TestAutoHeaderId extends JavadocTester {
private void checkSearchIndex() {
checkOutput("tag-search-index.js", true,
"""
{"l":"Duplicate Text","h":"class p.C","d":"Section","u":"p/C.html#duplicate-text-heading"}""",
{"l":"Duplicate Text","h":"class p.C","k":"16","u":"p/C.html#duplicate-text-heading"}""",
"""
{"l":"Duplicate Text","h":"class p.C","d":"Section","u":"p/C.html#duplicate-text-heading1"}""",
{"l":"Duplicate Text","h":"class p.C","k":"16","u":"p/C.html#duplicate-text-heading1"}""",
"""
{"l":"Embedded A-Tag with ID","h":"class p.C","d":"Section","u":"p/C.html#fixed-id-2"}""",
{"l":"Embedded A-Tag with ID","h":"class p.C","k":"16","u":"p/C.html#fixed-id-2"}""",
"""
{"l":"Embedded Code Tag","h":"class p.C","d":"Section","u":"p/C.html#embedded-code-tag-heading"}""",
{"l":"Embedded Code Tag","h":"class p.C","k":"16","u":"p/C.html#embedded-code-tag-heading"}""",
"""
{"l":"Embedded Link Tag","h":"class p.C","d":"Section","u":"p/C.html#embedded-link-tag-heading"}""",
{"l":"Embedded Link Tag","h":"class p.C","k":"16","u":"p/C.html#embedded-link-tag-heading"}""",
"""
{"l":"2.0 Extra (#*!. chars","h":"class p.C","d":"Section","u":"p/C.html#2-0-extra-chars-heading"}""",
{"l":"2.0 Extra (#*!. chars","h":"class p.C","k":"16","u":"p/C.html#2-0-extra-chars-heading"}""",
"""
{"l":"1.0 First Header","h":"class p.C","d":"Section","u":"p/C.html#1-0-first-header-heading"}""",
{"l":"1.0 First Header","h":"class p.C","k":"16","u":"p/C.html#1-0-first-header-heading"}""",
"""
{"l":"1.1 Header with ID","h":"class p.C","d":"Section","u":"p/C.html#fixed-id-1"}""",
{"l":"1.1 Header with ID","h":"class p.C","k":"16","u":"p/C.html#fixed-id-1"}""",
"""
{"l":"3.0 Multi-line heading with extra whitespace","h":"class p.C","d":"Section","u":"p/C.html\
{"l":"3.0 Multi-line heading with extra whitespace","h":"class p.C","k":"16","u":"p/C.html\
#3-0-multi-line-heading-with-extra-whitespace-heading"}""",
"""
{"l":"Other attributes","h":"class p.C","d":"Section","u":"p/C.html#other-attributes-heading"}""");
{"l":"Other attributes","h":"class p.C","k":"16","u":"p/C.html#other-attributes-heading"}""");
}
private void checkHtmlIndex() {
@ -182,50 +182,50 @@ public class TestAutoHeaderId extends JavadocTester {
<h2 class="title" id="I:D">D</h2>
<dl class="index">
<dt><a href="p/C.html#duplicate-text-heading" class="search-tag-link">Duplicate Text</a> \
- Search tag in class p.C</dt>
<dd>Section</dd>
- Section in class p.C</dt>
<dd>&nbsp;</dd>
<dt><a href="p/C.html#duplicate-text-heading1" class="search-tag-link">Duplicate Text</a>\
- Search tag in class p.C</dt>
<dd>Section</dd>
- Section in class p.C</dt>
<dd>&nbsp;</dd>
</dl>
<h2 class="title" id="I:E">E</h2>
<dl class="index">
<dt><a href="p/C.html#2-0-extra-chars-heading" class="search-tag-link">2.0 Extra (#*!. ch\
ars</a> - Search tag in class p.C</dt>
<dd>Section</dd>
ars</a> - Section in class p.C</dt>
<dd>&nbsp;</dd>
<dt><a href="p/C.html#fixed-id-2" class="search-tag-link">Embedded A-Tag with ID</a> - Se\
arch tag in class p.C</dt>
<dd>Section</dd>
ction in class p.C</dt>
<dd>&nbsp;</dd>
<dt><a href="p/C.html#embedded-code-tag-heading" class="search-tag-link">Embedded Code Ta\
g</a> - Search tag in class p.C</dt>
<dd>Section</dd>
g</a> - Section in class p.C</dt>
<dd>&nbsp;</dd>
<dt><a href="p/C.html#embedded-link-tag-heading" class="search-tag-link">Embedded Link Ta\
g</a> - Search tag in class p.C</dt>
<dd>Section</dd>
g</a> - Section in class p.C</dt>
<dd>&nbsp;</dd>
</dl>
<h2 class="title" id="I:F">F</h2>
<dl class="index">
<dt><a href="p/C.html#1-0-first-header-heading" class="search-tag-link">1.0 First Header<\
/a> - Search tag in class p.C</dt>
<dd>Section</dd>
/a> - Section in class p.C</dt>
<dd>&nbsp;</dd>
</dl>
<h2 class="title" id="I:H">H</h2>
<dl class="index">
<dt><a href="p/C.html#fixed-id-1" class="search-tag-link">1.1 Header with ID</a> - Search\
tag in class p.C</dt>
<dd>Section</dd>
<dt><a href="p/C.html#fixed-id-1" class="search-tag-link">1.1 Header with ID</a> - Sectio\
n in class p.C</dt>
<dd>&nbsp;</dd>
</dl>
<h2 class="title" id="I:M">M</h2>
<dl class="index">
<dt><a href="p/C.html#3-0-multi-line-heading-with-extra-whitespace-heading" class="search\
-tag-link">3.0 Multi-line heading with extra whitespace</a> - Search tag in class p.C</dt>
<dd>Section</dd>
-tag-link">3.0 Multi-line heading with extra whitespace</a> - Section in class p.C</dt>
<dd>&nbsp;</dd>
</dl>
<h2 class="title" id="I:O">O</h2>
<dl class="index">
<dt><a href="p/C.html#other-attributes-heading" class="search-tag-link">Other attributes<\
/a> - Search tag in class p.C</dt>
<dd>Section</dd>
/a> - Section in class p.C</dt>
<dd>&nbsp;</dd>
</dl>
<h2 class="title" id="I:P">P</h2>
<dl class="index">

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, 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
@ -119,9 +119,9 @@ public class TestErasure extends JavadocTester {
- Constructor for class <a href="Foo.html" title="class in Unnamed Package">Foo</a></dt>
<dd>&nbsp;</dd>""");
checkOutput("member-search-index.js", true, """
{"p":"<Unnamed>","c":"Foo","l":"Foo(T)","u":"%3Cinit%3E(T)"},\
{"p":"<Unnamed>","c":"Foo","l":"Foo(T)","u":"%3Cinit%3E(X)"},\
{"p":"<Unnamed>","c":"Foo","l":"Foo(T)","u":"%3Cinit%3E(Y)"}""");
{"p":"<Unnamed>","c":"Foo","l":"Foo(T)","u":"%3Cinit%3E(T)","k":"3"},\
{"p":"<Unnamed>","c":"Foo","l":"Foo(T)","u":"%3Cinit%3E(X)","k":"3"},\
{"p":"<Unnamed>","c":"Foo","l":"Foo(T)","u":"%3Cinit%3E(Y)","k":"3"}""");
// methods
checkOutput("Foo.html", true, """
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 \
@ -222,8 +222,8 @@ public class TestErasure extends JavadocTester {
- Constructor for class <a href="Foo.html" title="class in Unnamed Package">Foo</a></dt>
<dd>&nbsp;</dd>""");
checkOutput("member-search-index.js", true, """
{"p":"<Unnamed>","c":"Foo","l":"Foo(T)","u":"%3Cinit%3E(T)"},\
{"p":"<Unnamed>","c":"Foo","l":"Foo(T)","u":"%3Cinit%3E(X)"}""");
{"p":"<Unnamed>","c":"Foo","l":"Foo(T)","u":"%3Cinit%3E(T)","k":"3"},\
{"p":"<Unnamed>","c":"Foo","l":"Foo(T)","u":"%3Cinit%3E(X)","k":"3"}""");
// methods
checkOutput("Foo.html", true, """
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, 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
@ -24,7 +24,7 @@
/*
* @test
* @bug 4852280 4517115 4973608 4994589 8026567 8071982 8196202 8234746
* 8311264
* 8311264 8345555
* @summary Perform tests on index.html file.
* Also test that index-all.html has the appropriate output.
* Test for unnamed package in index.
@ -60,8 +60,8 @@ public class TestIndex extends JavadocTester {
<a href="pkg/C.html#c()" class="member-name-link">c()</a> - Method in class pkg.\
<a href="pkg/C.html" title="class in pkg">C</a>""",
"""
<a href="pkg/C.html#c-heading" class="search-tag-link">C</a> - Search tag in cla\
ss pkg.C""",
<a href="pkg/C.html#c-heading" class="search-tag-link">C</a> - Section in class \
pkg.C""",
"""
<a href="pkg/C.html" class="type-name-link" title="class in pkg">C</a> - Class i\
n <a href="pkg/package-summary.html">pkg</a>""",
@ -78,8 +78,8 @@ public class TestIndex extends JavadocTester {
<a href="pkg/C.html#c/d" class="search-tag-link">c/d</a> - Search tag in class p\
kg.C""",
"""
<a href="pkg/C.html#c-d-heading" class="search-tag-link">C/D</a> - Search tag in\
class pkg.C""",
<a href="pkg/C.html#c-d-heading" class="search-tag-link">C/D</a> - Section in cl\
ass pkg.C""",
"""
<a href="pkg/Coin.html" class="type-name-link" title="enum class in pkg">Coin</a\
> - Enum Class in <a href="pkg/package-summary.html">pkg</a>""",

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2025, 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,7 +23,7 @@
/*
* @test
* @bug 8235414
* @bug 8235414 8345555
* @summary Module level doc-files show "unnamed package" as holder
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -114,12 +114,11 @@ public class TestIndexInDocFiles extends JavadocTester {
"""
{"l":"package-index","h":"package p.q","d":"additional info","u":"p/q/doc-files/package-file.html#package-index"}""",
"""
{"l":"package.property","h":"package p.q","d":"System Property","u":"p/q/doc-files/package-file.html#package.property"}""",
{"l":"package.property","h":"package p.q","k":"15","u":"p/q/doc-files/package-file.html#package.property"}""",
"""
{"l":"top-level-index","h":"unnamed package","d":"additional info","u":"doc-files/top-level-file.html#top-level-index"}""",
"""
{"l":"top.level.property","h":"unnamed package","d":"System Property","u":"doc-f\
iles/top-level-file.html#top.level.property"}""");
{"l":"top.level.property","h":"unnamed package","k":"15","u":"doc-files/top-level-file.html#top.level.property"}""");
}
/**
@ -186,9 +185,8 @@ public class TestIndexInDocFiles extends JavadocTester {
"""
{"l":"package-index","h":"package p.q","d":"additional info","u":"m.n/p/q/doc-files/package-file.html#package-index"}""",
"""
{"l":"module.property","h":"module m.n","d":"System Property","u":"m.n/doc-files/module-file.html#module.property"}""",
{"l":"module.property","h":"module m.n","k":"15","u":"m.n/doc-files/module-file.html#module.property"}""",
"""
{"l":"package.property","h":"package p.q","d":"System Property","u":"m.n/p/q/doc\
-files/package-file.html#package.property"}""");
{"l":"package.property","h":"package p.q","k":"15","u":"m.n/p/q/doc-files/package-file.html#package.property"}""");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2025, 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,7 +23,7 @@
/*
* @test
* @bug 8292892
* @bug 8292892 8345555
* @summary Tests that members inherited from classes with package access are
* documented in the index as though they were declared in the
* inheriting class.
@ -73,8 +73,8 @@ public class TestIndexInherited extends JavadocTester {
private static final String[] SEARCH_INHERITED = {"""
{"p":"pkg1","c":"ClassB","l":"methodA()"}""", """
{"p":"pkg2","c":"ClassC","l":"methodA()"}""", """
{"p":"pkg1","c":"ClassB","l":"STRING_A"}""", """
{"p":"pkg2","c":"ClassC","l":"STRING_A"}"""};
{"p":"pkg1","c":"ClassB","l":"STRING_A","k":"2"}""", """
{"p":"pkg2","c":"ClassC","l":"STRING_A","k":"2"}"""};
/**
* Index entries for members declared by the superclass.
@ -92,7 +92,7 @@ public class TestIndexInherited extends JavadocTester {
*/
private static final String[] SEARCH_DECLARED = {"""
{"p":"pkg1","c":"ClassA","l":"methodA()"}""", """
{"p":"pkg1","c":"ClassA","l":"STRING_A"}"""};
{"p":"pkg1","c":"ClassA","l":"STRING_A","k":"2"}"""};
/**
* Sole constructor.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2025, 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
@ -216,7 +216,7 @@ public class TestMemberInheritance extends JavadocTester {
</dd>""");
checkOutput("member-search-index.js", true,
"""
{"p":"pkg2","c":"DocumentedNonGenericChild","l":"parentField"}""",
{"p":"pkg2","c":"DocumentedNonGenericChild","l":"parentField","k":"1"}""",
"""
{"p":"pkg2","c":"DocumentedNonGenericChild","l":"parentMethod(String)","u":"parentMethod(T)"}""");
// Search tags from inherited doc comments are not added to the index (8341904).
@ -265,7 +265,7 @@ public class TestMemberInheritance extends JavadocTester {
</dd>""");
checkOutput("member-search-index.js", true,
"""
{"p":"pkg2","c":"DocumentedNonGenericChild","l":"parentField"}""",
{"p":"pkg2","c":"DocumentedNonGenericChild","l":"parentField","k":"1"}""",
"""
{"p":"pkg2","c":"DocumentedNonGenericChild","l":"parentMethod(String)","u":"parentMethod(T)"}""");
// Search tags from inherited doc comments are not added to the index (8341904).

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, 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
@ -184,9 +184,9 @@ public class TestModulePackages extends JavadocTester {
{"p":"p","m":"m","l":"C"},{"p":"p","m":"o","l":"C"}""");
checkOutput("member-search-index.js", true,
"""
{"m":"m","p":"p","c":"C","l":"C()","u":"%3Cinit%3E()"}""",
{"m":"m","p":"p","c":"C","l":"C()","u":"%3Cinit%3E()","k":"3"}""",
"""
{"m":"o","p":"p","c":"C","l":"C()","u":"%3Cinit%3E()"}""");
{"m":"o","p":"p","c":"C","l":"C()","u":"%3Cinit%3E()","k":"3"}""");
}
@Test

View File

@ -1437,10 +1437,10 @@ public class TestModules extends JavadocTester {
<table summary="Package Summary table, listing packages, and an explanation">""");
checkOutput("type-search-index.js", true,
"""
{"l":"All Classes and Interfaces","u":"allclasses-index.html"}""");
{"l":"All Classes and Interfaces","u":"allclasses-index.html","k":"18"}""");
checkOutput("package-search-index.js", true,
"""
{"l":"All Packages","u":"allpackages-index.html"}""");
{"l":"All Packages","u":"allpackages-index.html","k":"18"}""");
checkOutput("index-all.html", true,
"""
<br><a href="allclasses-index.html">All&nbsp;Classes&nbsp;and&nbsp;Interfaces</a\

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 8263468 8269401 8268422 8287524 8325874 8331873
* @bug 8263468 8269401 8268422 8287524 8325874 8331873 8345555
* @summary New page for "recent" new API
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -103,21 +103,7 @@ public class TestNewApiList extends JavadocTester {
"""
<h1 title="New API in recent releases" class="title">New API in recent releases</h1>
</div>
<div class="checkboxes">Show API added in: <label for="release-1">
<input type="checkbox" id="release-1" disabled checked onclick="toggleGlobal(this, '1', 3)">
<span>0.9</span></label> <label for="release-2">
<input type="checkbox" id="release-2" disabled checked onclick="toggleGlobal(this, '2', 3)">
<span>v1.0</span></label> <label for="release-3">
<input type="checkbox" id="release-3" disabled checked onclick="toggleGlobal(this, '3', 3)">
<span>1.2</span></label> <label for="release-4">
<input type="checkbox" id="release-4" disabled checked onclick="toggleGlobal(this, '4', 3)">
<span>2.0b</span></label> <label for="release-5">
<input type="checkbox" id="release-5" disabled checked onclick="toggleGlobal(this, '5', 3)">
<span>3.2</span></label> <label for="release-6">
<input type="checkbox" id="release-6" disabled checked onclick="toggleGlobal(this, '6', 3)">
<span>5</span></label> <label for="release-all">
<input type="checkbox" id="release-all" disabled checked onclick="toggleGlobal(this, 'all', 3)">
<span>Toggle all</span></label></div>
<div class="checkboxes">Show API added in: <label for="release-1"><input type="checkbox" id="release-1" disabled checked onclick="toggleGlobal(this, '1', 3)"><span>0.9</span></label> <label for="release-2"><input type="checkbox" id="release-2" disabled checked onclick="toggleGlobal(this, '2', 3)"><span>v1.0</span></label> <label for="release-3"><input type="checkbox" id="release-3" disabled checked onclick="toggleGlobal(this, '3', 3)"><span>1.2</span></label> <label for="release-4"><input type="checkbox" id="release-4" disabled checked onclick="toggleGlobal(this, '4', 3)"><span>2.0b</span></label> <label for="release-5"><input type="checkbox" id="release-5" disabled checked onclick="toggleGlobal(this, '5', 3)"><span>3.2</span></label> <label for="release-6"><input type="checkbox" id="release-6" disabled checked onclick="toggleGlobal(this, '6', 3)"><span>5</span></label> <label for="release-all"><input type="checkbox" id="release-all" disabled checked onclick="toggleGlobal(this, 'all', 3)"><span>Toggle all</span></label></div>
<h2 title="Contents">Contents</h2>
<ul class="contents-list">
<li id="contents-module"><a href="#module">Modules</a></li>
@ -604,13 +590,12 @@ public class TestNewApiList extends JavadocTester {
"""
<h1 title="Deprecated API" class="title">Deprecated API</h1>
</div>
<div class="checkboxes">Show API deprecated in: <label for="release-1">
<input type="checkbox" id="release-1" disabled checked onclick="toggleGlobal(this, '1', 3)">
<span>5</span></label> <label for="release-other">
<input type="checkbox" id="release-other" disabled checked onclick="toggleGlobal(this, 'other', 3)">
<span>other</span></label> <label for="release-all">
<input type="checkbox" id="release-all" disabled checked onclick="toggleGlobal(this, 'all', 3)">
<span>Toggle all</span></label></div>
<div class="checkboxes">Show API deprecated in: <label for="release-1"><input type="\
checkbox" id="release-1" disabled checked onclick="toggleGlobal(this, '1', 3)"><span\
>5</span></label> <label for="release-other"><input type="checkbox" id="release-othe\
r" disabled checked onclick="toggleGlobal(this, 'other', 3)"><span>other</span></lab\
el> <label for="release-all"><input type="checkbox" id="release-all" disabled checke\
d onclick="toggleGlobal(this, 'all', 3)"><span>Toggle all</span></label></div>
<h2 title="Contents">Contents</h2>
<ul class="contents-list">
<li id="contents-for-removal"><a href="#for-removal">Terminally Deprecated</a></li>
@ -671,19 +656,17 @@ public class TestNewApiList extends JavadocTester {
"""
<h1 title="New API" class="title">New API</h1>
</div>
<div class="checkboxes">Show API added in: <label for="release-1">
<input type="checkbox" id="release-1" disabled checked onclick="toggleGlobal(this, '1', 3)">
<span>1.2</span></label> <label for="release-2">
<input type="checkbox" id="release-2" disabled checked onclick="toggleGlobal(this, '2', 3)">
<span>2.0b</span></label> <label for="release-3">
<input type="checkbox" id="release-3" disabled checked onclick="toggleGlobal(this, '3', 3)">
<span>3.2</span></label> <label for="release-4">
<input type="checkbox" id="release-4" disabled checked onclick="toggleGlobal(this, '4', 3)">
<span>5</span></label> <label for="release-5">
<input type="checkbox" id="release-5" disabled checked onclick="toggleGlobal(this, '5', 3)">
<span>6</span></label> <label for="release-all">
<input type="checkbox" id="release-all" disabled checked onclick="toggleGlobal(this, 'all', 3)">
<span>Toggle all</span></label></div>
<div class="checkboxes">Show API added in: <label for="release-1"><input type="check\
box" id="release-1" disabled checked onclick="toggleGlobal(this, '1', 3)"><span>1.2<\
/span></label> <label for="release-2"><input type="checkbox" id="release-2" disabled\
checked onclick="toggleGlobal(this, '2', 3)"><span>2.0b</span></label> <label for="\
release-3"><input type="checkbox" id="release-3" disabled checked onclick="toggleGlo\
bal(this, '3', 3)"><span>3.2</span></label> <label for="release-4"><input type="chec\
kbox" id="release-4" disabled checked onclick="toggleGlobal(this, '4', 3)"><span>5</\
span></label> <label for="release-5"><input type="checkbox" id="release-5" disabled \
checked onclick="toggleGlobal(this, '5', 3)"><span>6</span></label> <label for="rele\
ase-all"><input type="checkbox" id="release-all" disabled checked onclick="toggleGlo\
bal(this, 'all', 3)"><span>Toggle all</span></label></div>
<h2 title="Contents">Contents</h2>
<ul class="contents-list">
<li id="contents-class"><a href="#class">Classes</a></li>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, 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
@ -464,7 +464,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
//=================================
checkOutput("index-all.html", true,
"""
<a href="pkg2/Foo.html#method(java.util.Vector)" class="member-name-link">method(Vector&lt;Object&gt;)</a>"""
<a href="pkg2/Foo.html#method(java.util.Vector)" class="member-name-link">method(Vector)</a>"""
);
// TODO: duplicate of previous case; left in delibarately for now to simplify comparison testing
@ -473,7 +473,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
//=================================
checkOutput("index-all.html", true,
"""
<a href="pkg2/Foo.html#method(java.util.Vector)" class="member-name-link">method(Vector&lt;Object&gt;)</a>"""
<a href="pkg2/Foo.html#method(java.util.Vector)" class="member-name-link">method(Vector)</a>"""
);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2025, 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
@ -101,10 +101,10 @@ public class TestPackagePage extends JavadocTester {
""");
checkOutput("type-search-index.js", true,
"""
{"l":"All Classes and Interfaces","u":"allclasses-index.html"}""");
{"l":"All Classes and Interfaces","u":"allclasses-index.html","k":"18"}""");
checkOutput("package-search-index.js", true,
"""
{"l":"All Packages","u":"allpackages-index.html"}""");
{"l":"All Packages","u":"allpackages-index.html","k":"18"}""");
checkOutput("index-all.html", true,
"""
<br><a href="allclasses-index.html">All&nbsp;Classes&nbsp;and&nbsp;Interfaces</a\

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, 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
@ -88,12 +88,11 @@ public class TestPreview extends JavadocTester {
checkOutput("preview-list.html", true,
"""
<ul class="preview-feature-list checkboxes">
<li><label for="feature-1">
<input type="checkbox" id="feature-1" disabled checked onclick="toggleGlobal(this, '1', 3)">
<span>2147483647: <a href="https://openjdk.org/jeps/2147483647">Test Feature (Preview)</a></span></label></li>
<li><label for="feature-all">
<input type="checkbox" id="feature-all" disabled checked onclick="toggleGlobal(this, 'all', 3)">
<span>Toggle all</span></label></li>
<li><label for="feature-1"><input type="checkbox" id="feature-1" disabled checked onclick="tog\
gleGlobal(this, '1', 3)"><span>2147483647: <a href="https://openjdk.org/jeps/2147483647">Test \
Feature (Preview)</a></span></label></li>
<li><label for="feature-all"><input type="checkbox" id="feature-all" disabled checked onclick=\
"toggleGlobal(this, 'all', 3)"><span>Toggle all</span></label></li>
</ul>
<h2 title="Contents">Contents</h2>
<ul class="contents-list">

View File

@ -26,7 +26,7 @@
* @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881
* 8181622 8182263 8074407 8187521 8198522 8182765 8199278 8196201 8196202
* 8184205 8214468 8222548 8223378 8234746 8241219 8254627 8247994 8263528
* 8266808 8248863 8305710 8318082 8347058 8350638
* 8266808 8248863 8305710 8318082 8347058 8350638 8345555
* @summary Test the search feature of javadoc.
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -392,20 +392,20 @@ public class TestSearch extends JavadocTester {
void checkSearchIndex() {
checkOutput("member-search-index.js", true,
"""
{"p":"pkg","c":"AnotherClass","l":"AnotherClass()","u":"%3Cinit%3E()"}""",
{"p":"pkg","c":"AnotherClass","l":"AnotherClass()","u":"%3Cinit%3E()","k":"3"}""",
"""
{"p":"pkg1","c":"RegClass","l":"RegClass()","u":"%3Cinit%3E()"}""",
{"p":"pkg1","c":"RegClass","l":"RegClass()","u":"%3Cinit%3E()","k":"3"}""",
"""
{"p":"pkg2","c":"TestError","l":"TestError()","u":"%3Cinit%3E()"}""",
{"p":"pkg2","c":"TestError","l":"TestError()","u":"%3Cinit%3E()","k":"3"}""",
"""
{"p":"pkg","c":"AnotherClass","l":"method(byte[], int, String)","u":"method(byte[],int,java.lang.String)"}""");
checkOutput("member-search-index.js", false,
"""
{"p":"pkg","c":"AnotherClass","l":"method(RegClass)","u":"method-pkg1.RegClass-"}""",
"""
{"p":"pkg2","c":"TestClass","l":"TestClass()","u":"TestClass--","k":"3"}""",
"""
{"p":"pkg2","c":"TestClass","l":"TestClass()","u":"TestClass--"}""",
"""
{"p":"pkg","c":"TestError","l":"TestError()","u":"TestError--"}""",
{"p":"pkg","c":"TestError","l":"TestError()","u":"TestError--","k":"3"}""",
"""
{"p":"pkg","c":"AnotherClass","l":"method(byte[], int, String)","u":"method-byte:A-int-java.lang.String-"}""");
}
@ -432,11 +432,10 @@ public class TestSearch extends JavadocTester {
"""
<li><a href="search.html">Search</a></li>""",
"""
<div class="nav-list-search">
<input type="text" id="search-input" disabled placeholder="Search documentation \
(type /)" aria-label="Search in documentation" autocomplete="off" spellcheck="false">
<input type="reset" id="reset-search" disabled value="Reset">
</div>""");
<div class="nav-list-search"><input type="text" id="search-input" disabled place\
holder="Search documentation (type /)" aria-label="Search in documentation" auto\
complete="off" spellcheck="false"><input type="reset" id="reset-search" disabled\
value="Reset"></div>""");
}
void checkSingleIndex() {
@ -797,10 +796,10 @@ public class TestSearch extends JavadocTester {
""");
checkOutput("type-search-index.js", true,
"""
{"l":"All Classes and Interfaces","u":"allclasses-index.html"}""");
{"l":"All Classes and Interfaces","u":"allclasses-index.html","k":"18"}""");
checkOutput("package-search-index.js", true,
"""
{"l":"All Packages","u":"allpackages-index.html"}""");
{"l":"All Packages","u":"allpackages-index.html","k":"18"}""");
checkOutput("index-all.html", true,
"""
<br><a href="allclasses-index.html">All&nbsp;Classes&nbsp;and&nbsp;Interface\
@ -835,7 +834,7 @@ public class TestSearch extends JavadocTester {
"""
{"l":"SearchWordWithDescription","h":"pkg1.RegClass.CONSTANT_FIELD_1","d":"search word with desc","u":"pkg1/RegClass.html#SearchWordWithDescription"}""",
"""
{"l":"Serialized Form","h":"","u":"serialized-form.html"},{"l":"SingleWord","h":"package pkg","u":"pkg/package-summary.html#SingleWord"}""",
{"l":"Serialized Form","h":"","k":"18","u":"serialized-form.html"},{"l":"SingleWord","h":"package pkg","u":"pkg/package-summary.html#SingleWord"}""",
"""
{"l":"trailing","h":"pkg.AnotherClass.method(byte[], int, String)","d":"backslash\\\\","u":"pkg/AnotherClass.html#trailing"}]""");
}

View File

@ -132,11 +132,10 @@ public class TestSpecTag extends JavadocTester {
<div class="sub-nav">
<div class="nav-content">
<ol class="sub-nav-list"></ol>
<div class="nav-list-search">
<input type="text" id="search-input" disabled placeholder="Search documentation \
(type /)" aria-label="Search in documentation" autocomplete="off" spellcheck="false">
<input type="reset" id="reset-search" disabled value="Reset">
</div>
<div class="nav-list-search"><input type="text" id="search-input" disabled place\
holder="Search documentation (type /)" aria-label="Search in documentation" auto\
complete="off" spellcheck="false"><input type="reset" id="reset-search" disabled\
value="Reset"></div>
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->

View File

@ -117,7 +117,7 @@ public class TestStylesheet extends JavadocTester {
display:inline-block;
}""",
"""
input#reset-search, input.reset-filter {
input#reset-search, input.reset-filter, input#page-search-reset {
background-color: transparent;
background-image:url('x.svg');
background-repeat:no-repeat;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2025, 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,7 +23,7 @@
/*
* @test
* @bug 5076751 8234746
* @bug 5076751 8234746 8345555
* @summary System properties documentation needed in javadoc
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -166,169 +166,163 @@ public class TestSystemPropertyTaglet extends JavadocTester {
<h2 class="title" id="I:T">T</h2>""",
"""
<dt><a href="mymodule/mypackage/MyAnnotation.html#\
test.property" class="search-tag-link">test.property</a> - Search tag in annotation interface mypackag\
test.property" class="search-tag-link">test.property</a> - System property in annotation interface mypackag\
e.MyAnnotation</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyClass.html#test.\
property" class="search-tag-link">test.property</a> - Search tag in class mypackage.MyClass</dt>
<dd>System Property</dd>""",
property" class="search-tag-link">test.property</a> - System property in class mypackage.MyClass</dt>
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyEnum.html#test.p\
roperty" class="search-tag-link">test.property</a> - Search tag in enum class mypackage.MyEnum</dt>
<dd>System Property</dd>""",
roperty" class="search-tag-link">test.property</a> - System property in enum class mypackage.MyEnum</dt>
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyError.html#test.\
property" class="search-tag-link">test.property</a> - Search tag in exception class mypackage.MyE\
property" class="search-tag-link">test.property</a> - System property in exception class mypackage.MyE\
rror</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyException.html#t\
est.property" class="search-tag-link">test.property</a> - Search tag in exception class mypackage\
est.property" class="search-tag-link">test.property</a> - System property in exception class mypackage\
.MyException</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyInterface.html#t\
est.property" class="search-tag-link">test.property</a> - Search tag in interface mypackage.MyInt\
est.property" class="search-tag-link">test.property</a> - System property in interface mypackage.MyInt\
erface</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/module-summary.html#test.pro\
perty" class="search-tag-link">test.property</a> - Search tag in module mymodule</dt>
<dd>System Property</dd>""",
perty" class="search-tag-link">test.property</a> - System property in module mymodule</dt>
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyAnnotation.html#\
test.property-1" class="search-tag-link">test.property</a> - Search tag in mypackage.MyAnnotation\
test.property-1" class="search-tag-link">test.property</a> - System property in mypackage.MyAnnotation\
.value()</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyClass.html#test.\
property-2" class="search-tag-link">test.property</a> - Search tag in mypackage.MyClass.INT_CONST\
property-2" class="search-tag-link">test.property</a> - System property in mypackage.MyClass.INT_CONST\
ANT</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyClass.html#test.\
property-3" class="search-tag-link">test.property</a> - Search tag in mypackage.MyClass.MyClass()\
property-3" class="search-tag-link">test.property</a> - System property in mypackage.MyClass.MyClass()\
</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyClass.html#test.\
property-1" class="search-tag-link">test.property</a> - Search tag in mypackage.MyClass.intField<\
property-1" class="search-tag-link">test.property</a> - System property in mypackage.MyClass.intField<\
/dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyClass.html#test.\
property-5" class="search-tag-link">test.property</a> - Search tag in mypackage.MyClass.run()</dt\
property-5" class="search-tag-link">test.property</a> - System property in mypackage.MyClass.run()</dt\
>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyClass.html#test.\
property-4" class="search-tag-link">test.property</a> - Search tag in mypackage.MyClass.value()</\
property-4" class="search-tag-link">test.property</a> - System property in mypackage.MyClass.value()</\
dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyEnum.html#test.p\
roperty-1" class="search-tag-link">test.property</a> - Search tag in mypackage.MyEnum.X</dt>
<dd>System Property</dd>""",
roperty-1" class="search-tag-link">test.property</a> - System property in mypackage.MyEnum.X</dt>
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyEnum.html#test.p\
roperty-2" class="search-tag-link">test.property</a> - Search tag in mypackage.MyEnum.m()</dt>
<dd>System Property</dd>""",
roperty-2" class="search-tag-link">test.property</a> - System property in mypackage.MyEnum.m()</dt>
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyError.html#test.\
property-1" class="search-tag-link">test.property</a> - Search tag in mypackage.MyError.MyError()\
property-1" class="search-tag-link">test.property</a> - System property in mypackage.MyError.MyError()\
</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyException.html#t\
est.property-1" class="search-tag-link">test.property</a> - Search tag in mypackage.MyException.M\
est.property-1" class="search-tag-link">test.property</a> - System property in mypackage.MyException.M\
yException()</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyInterface.html#t\
est.property-1" class="search-tag-link">test.property</a> - Search tag in mypackage.MyInterface.I\
est.property-1" class="search-tag-link">test.property</a> - System property in mypackage.MyInterface.I\
NT_CONSTANT</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyInterface.html#t\
est.property-2" class="search-tag-link">test.property</a> - Search tag in mypackage.MyInterface.m\
est.property-2" class="search-tag-link">test.property</a> - System property in mypackage.MyInterface.m\
()</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/MyInterface.html#t\
est.property-3" class="search-tag-link">test.property</a> - Search tag in mypackage.MyInterface.m\
est.property-3" class="search-tag-link">test.property</a> - System property in mypackage.MyInterface.m\
(String...)</dt>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"""
<dt><a href="mymodule/mypackage/package-summary.ht\
ml#test.property" class="search-tag-link">test.property</a> - Search tag in package mypackage</dt\
ml#test.property" class="search-tag-link">test.property</a> - System property in package mypackage</dt\
>
<dd>System Property</dd>""",
<dd>&nbsp;</dd>""",
"");
checkOutput("tag-search-index.js", true,
"""
{"l":"test.property","h":"annotation interface mypackage.MyAnnotation","d":"System Pr\
operty","u":"mymodule/mypackage/MyAnnotation.html#test.property"}""",
{"l":"test.property","h":"annotation interface mypackage.MyAnnotation","k":"15","u":"mymodule/mypackage/MyAnnotation.html#test.property"}""",
"""
{"l":"test.property","h":"class mypackage.MyClass","d":"System Property","u":"my\
{"l":"test.property","h":"class mypackage.MyClass","k":"15","u":"my\
module/mypackage/MyClass.html#test.property"}""",
"""
{"l":"test.property","h":"enum class mypackage.MyEnum","d":"System Property","u"\
{"l":"test.property","h":"enum class mypackage.MyEnum","k":"15","u"\
:"mymodule/mypackage/MyEnum.html#test.property"}""",
"""
{"l":"test.property","h":"exception class mypackage.MyError","d":"System Propert\
y","u":"mymodule/mypackage/MyError.html#test.property"}""",
{"l":"test.property","h":"exception class mypackage.MyError","k":"15","u":"mymodule/mypackage/MyError.html#test.property"}""",
"""
{"l":"test.property","h":"exception class mypackage.MyException","d":"System Pro\
perty","u":"mymodule/mypackage/MyException.html#test.property"}""",
{"l":"test.property","h":"exception class mypackage.MyException","k":"15","u":"mymodule/mypackage/MyException.html#test.property"}""",
"""
{"l":"test.property","h":"interface mypackage.MyInterface","d":"System Property"\
{"l":"test.property","h":"interface mypackage.MyInterface","k":"15"\
,"u":"mymodule/mypackage/MyInterface.html#test.property"}""",
"""
{"l":"test.property","h":"module mymodule","d":"System Property","u":"mymodule/m\
{"l":"test.property","h":"module mymodule","k":"15","u":"mymodule/m\
odule-summary.html#test.property"}""",
"""
{"l":"test.property","h":"mypackage.MyAnnotation.value()","d":"System Property",\
{"l":"test.property","h":"mypackage.MyAnnotation.value()","k":"15",\
"u":"mymodule/mypackage/MyAnnotation.html#test.property-1"}""",
"""
{"l":"test.property","h":"mypackage.MyClass.INT_CONSTANT","d":"System Property",\
{"l":"test.property","h":"mypackage.MyClass.INT_CONSTANT","k":"15",\
"u":"mymodule/mypackage/MyClass.html#test.property-2"}""",
"""
{"l":"test.property","h":"mypackage.MyClass.MyClass()","d":"System Property","u"\
{"l":"test.property","h":"mypackage.MyClass.MyClass()","k":"15","u"\
:"mymodule/mypackage/MyClass.html#test.property-3"}""",
"""
{"l":"test.property","h":"mypackage.MyClass.intField","d":"System Property","u":\
{"l":"test.property","h":"mypackage.MyClass.intField","k":"15","u":\
"mymodule/mypackage/MyClass.html#test.property-1"}""",
"""
{"l":"test.property","h":"mypackage.MyClass.run()","d":"System Property","u":"my\
{"l":"test.property","h":"mypackage.MyClass.run()","k":"15","u":"my\
module/mypackage/MyClass.html#test.property-5"}""",
"""
{"l":"test.property","h":"mypackage.MyClass.value()","d":"System Property","u":"\
{"l":"test.property","h":"mypackage.MyClass.value()","k":"15","u":"\
mymodule/mypackage/MyClass.html#test.property-4"}""",
"""
{"l":"test.property","h":"mypackage.MyEnum.X","d":"System Property","u":"mymodul\
{"l":"test.property","h":"mypackage.MyEnum.X","k":"15","u":"mymodul\
e/mypackage/MyEnum.html#test.property-1"}""",
"""
{"l":"test.property","h":"mypackage.MyEnum.m()","d":"System Property","u":"mymod\
{"l":"test.property","h":"mypackage.MyEnum.m()","k":"15","u":"mymod\
ule/mypackage/MyEnum.html#test.property-2"}""",
"""
{"l":"test.property","h":"mypackage.MyError.MyError()","d":"System Property","u"\
{"l":"test.property","h":"mypackage.MyError.MyError()","k":"15","u"\
:"mymodule/mypackage/MyError.html#test.property-1"}""",
"""
{"l":"test.property","h":"mypackage.MyException.MyException()","d":"System Prope\
rty","u":"mymodule/mypackage/MyException.html#test.property-1"}""",
{"l":"test.property","h":"mypackage.MyException.MyException()","k":"15","u":"mymodule/mypackage/MyException.html#test.property-1"}""",
"""
{"l":"test.property","h":"mypackage.MyInterface.INT_CONSTANT","d":"System Proper\
ty","u":"mymodule/mypackage/MyInterface.html#test.property-1"}""",
{"l":"test.property","h":"mypackage.MyInterface.INT_CONSTANT","k":"15","u":"mymodule/mypackage/MyInterface.html#test.property-1"}""",
"""
{"l":"test.property","h":"mypackage.MyInterface.m()","d":"System Property","u":"\
{"l":"test.property","h":"mypackage.MyInterface.m()","k":"15","u":"\
mymodule/mypackage/MyInterface.html#test.property-2"}""",
"""
{"l":"test.property","h":"mypackage.MyInterface.m(String...)","d":"System Proper\
ty","u":"mymodule/mypackage/MyInterface.html#test.property-3"}""",
{"l":"test.property","h":"mypackage.MyInterface.m(String...)","k":"15","u":"mymodule/mypackage/MyInterface.html#test.property-3"}""",
"""
{"l":"test.property","h":"package mypackage","d":"System Property","u":"mymodule\
{"l":"test.property","h":"package mypackage","k":"15","u":"mymodule\
/mypackage/package-summary.html#test.property"}""",
"");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, 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
@ -103,11 +103,11 @@ public class TestUnnamedPackage extends JavadocTester {
checkOutput("type-search-index.js", true,
"""
{"l":"All Classes and Interfaces","u":"allclasses-index.html"}""");
{"l":"All Classes and Interfaces","u":"allclasses-index.html","k":"18"}""");
checkOutput("package-search-index.js", true,
"""
{"l":"All Packages","u":"allpackages-index.html"}""");
{"l":"All Packages","u":"allpackages-index.html","k":"18"}""");
checkOutput("index-all.html", true,
"""
@ -117,17 +117,17 @@ public class TestUnnamedPackage extends JavadocTester {
checkOutput("type-search-index.js", true,
"""
{"l":"All Classes and Interfaces","u":"allclasses-index.html"}""",
{"l":"All Classes and Interfaces","u":"allclasses-index.html","k":"18"}""",
"""
{"p":"<Unnamed>","l":"C"}""");
checkOutput("member-search-index.js", true,
"""
{"p":"<Unnamed>","c":"C","l":"C()","u":"%3Cinit%3E()"}""");
{"p":"<Unnamed>","c":"C","l":"C()","u":"%3Cinit%3E()","k":"3"}""");
checkOutput("package-search-index.js", true,
"""
{"l":"All Packages","u":"allpackages-index.html"}""");
{"l":"All Packages","u":"allpackages-index.html","k":"18"}""");
checkOutput("package-search-index.js", false, "Unnamed");