8258002: Update "type" terminology in generated docs

Reviewed-by: hannesw
This commit is contained in:
Jonathan Gibbons 2020-12-18 18:34:25 +00:00
parent 45bd3b9ec0
commit c04c7e1f10
45 changed files with 511 additions and 240 deletions

@ -27,13 +27,9 @@ package jdk.javadoc.internal.doclets.formats.html;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.TypeParameterElement;
import javax.lang.model.type.TypeMirror;
@ -46,7 +42,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Links;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.toolkit.Content;
@ -54,15 +49,8 @@ import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
import jdk.javadoc.internal.doclets.toolkit.MemberWriter;
import jdk.javadoc.internal.doclets.toolkit.Resources;
import jdk.javadoc.internal.doclets.toolkit.taglets.DeprecatedTaglet;
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
import static javax.lang.model.element.Modifier.ABSTRACT;
import static javax.lang.model.element.Modifier.NATIVE;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STRICTFP;
import static javax.lang.model.element.Modifier.SYNCHRONIZED;
/**
* The base class for member writers.
*
@ -89,7 +77,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter, Membe
this.writer = writer;
this.typeElement = typeElement;
this.utils = configuration.utils;
this.contents = configuration.contents;
this.contents = configuration.getContents();
this.resources = configuration.docResources;
this.links = writer.links;
}

@ -116,12 +116,12 @@ public class AllClassesIndexWriter extends HtmlDocletWriter {
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast)
.setId("all-classes-table")
.setDefaultTab(resources.getText("doclet.All_Classes"))
.addTab(resources.interfaceSummary, utils::isInterface)
.addTab(resources.classSummary, e -> utils.isOrdinaryClass((TypeElement)e))
.addTab(resources.enumSummary, utils::isEnum)
.addTab(resources.exceptionSummary, e -> utils.isException((TypeElement)e))
.addTab(resources.errorSummary, e -> utils.isError((TypeElement)e))
.addTab(resources.annotationTypeSummary, utils::isAnnotationType);
.addTab(contents.interfaceSummary, utils::isInterface)
.addTab(contents.classSummary, e -> utils.isOrdinaryClass((TypeElement)e))
.addTab(contents.enumSummary, utils::isEnum)
.addTab(contents.exceptionSummary, e -> utils.isException((TypeElement)e))
.addTab(contents.errorSummary, e -> utils.isError((TypeElement)e))
.addTab(contents.annotationTypeSummary, utils::isAnnotationType);
for (Character unicode : indexBuilder.getFirstCharacters()) {
for (IndexItem indexItem : indexBuilder.getItems(unicode)) {
TypeElement typeElement = (TypeElement) indexItem.getElement();

@ -96,7 +96,7 @@ public class AllPackagesIndexWriter extends HtmlDocletWriter {
*/
protected void addPackages(Content content) {
Table table = new Table(HtmlStyle.summaryTable)
.setCaption(new StringContent(resources.packageSummary))
.setCaption(new StringContent(contents.packageSummary))
.setHeader(new TableHeader(contents.packageLabel, contents.descriptionLabel))
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
for (PackageElement pkg : configuration.packages) {

@ -66,8 +66,9 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
@Override
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
memberSummaryTree.add(
MarkerComments.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY);
memberSummaryTree.add(selectComment(
MarkerComments.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY,
MarkerComments.START_OF_ANNOTATION_INTERFACE_OPTIONAL_MEMBER_SUMMARY));
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, memberTree);
return memberTree;

@ -25,11 +25,13 @@
package jdk.javadoc.internal.doclets.formats.html;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
import jdk.javadoc.internal.doclets.formats.html.markup.Comment;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
@ -66,8 +68,9 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
@Override
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
memberSummaryTree.add(
MarkerComments.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY);
memberSummaryTree.add(selectComment(
MarkerComments.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY,
MarkerComments.START_OF_ANNOTATION_INTERFACE_REQUIRED_MEMBER_SUMMARY));
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, memberTree);
return memberTree;
@ -86,7 +89,9 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
@Override
public void addAnnotationDetailsMarker(Content memberDetails) {
memberDetails.add(MarkerComments.START_OF_ANNOTATION_TYPE_DETAILS);
memberDetails.add(selectComment(
MarkerComments.START_OF_ANNOTATION_TYPE_DETAILS,
MarkerComments.START_OF_ANNOTATION_INTERFACE_DETAILS));
}
@Override
@ -201,6 +206,12 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, member, name);
}
protected Comment selectComment(Comment c1, Comment c2) {
HtmlConfiguration configuration = writer.configuration;
SourceVersion sv = configuration.docEnv.getSourceVersion();
return sv.compareTo(SourceVersion.RELEASE_16) < 0 ? c1 : c2;
}
private TypeMirror getType(Element member) {
return utils.isExecutableElement(member)
? utils.getReturnType(typeElement, (ExecutableElement) member)

@ -412,9 +412,13 @@ public class ClassUseWriter extends SubWriterHolderWriter {
* @return a content tree representing the class use header
*/
protected HtmlTree getClassUseHeader() {
String cltype = resources.getText(utils.isInterface(typeElement)
? "doclet.Interface"
: "doclet.Class");
String cltype = resources.getText(switch (typeElement.getKind()) {
case ANNOTATION_TYPE -> "doclet.AnnotationType";
case INTERFACE -> "doclet.Interface";
case RECORD -> "doclet.RecordClass";
case ENUM -> "doclet.Enum";
default -> "doclet.Class";
});
String clname = utils.getFullyQualifiedName(typeElement);
String title = resources.getText("doclet.Window_ClassUse_Header",
cltype, clname);

@ -177,6 +177,15 @@ public class Contents {
private final EnumMap<VisibleMemberTable.Kind, Content> navLinkLabels;
public final String annotationTypeSummary;
public final String classSummary;
public final String enumSummary;
public final String errorSummary;
public final String exceptionSummary;
public final String interfaceSummary;
public final String packageSummary;
public final String recordSummary;
private final Resources resources;
/**
@ -289,7 +298,7 @@ public class Contents {
propertyLabel = getContent("doclet.Property");
propertyDetailsLabel = getContent("doclet.Property_Detail");
propertySummaryLabel = getContent("doclet.Property_Summary");
record = getContent("doclet.Record");
record = getContent("doclet.RecordClass");
recordComponents = getContent("doclet.RecordComponents");
referencedIn = getContent("doclet.ReferencedIn");
returns = getContent("doclet.Returns");
@ -315,6 +324,15 @@ public class Contents {
navLinkLabels.put(VisibleMemberTable.Kind.FIELDS, getContent("doclet.navField"));
navLinkLabels.put(VisibleMemberTable.Kind.CONSTRUCTORS, getContent("doclet.navConstructor"));
navLinkLabels.put(VisibleMemberTable.Kind.METHODS, getContent("doclet.navMethod"));
this.annotationTypeSummary = resources.getText("doclet.Annotation_Types_Summary");
this.classSummary = resources.getText("doclet.Class_Summary");
this.enumSummary = resources.getText("doclet.Enum_Summary");
this.errorSummary = resources.getText("doclet.Error_Summary");
this.exceptionSummary = resources.getText("doclet.Exception_Summary");
this.interfaceSummary = resources.getText("doclet.Interface_Summary");
this.packageSummary = resources.getText("doclet.Package_Summary");
this.recordSummary = resources.getText("doclet.Record_Class_Summary");
}
/**

@ -78,13 +78,13 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
case CLASS:
return "class";
case ENUM:
return "enum";
return "enum.class";
case EXCEPTION:
return "exception";
case ERROR:
return "error";
case ANNOTATION_TYPE:
return "annotation.type";
return "annotation.interface";
case FIELD:
return "field";
case METHOD:
@ -94,7 +94,7 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
case ENUM_CONSTANT:
return "enum.constant";
case ANNOTATION_TYPE_MEMBER:
return "annotation.type.member";
return "annotation.interface.member";
case RECORD_CLASS:
return "record.class";
default:
@ -197,7 +197,7 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
case ANNOTATION_TYPE:
return "doclet.AnnotationType";
case RECORD_CLASS:
return "doclet.Record";
return "doclet.RecordClass";
case FIELD:
return "doclet.Field";
case METHOD:
@ -287,17 +287,13 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
throws DocFileIOException {
HtmlTree body = getHeader();
bodyContents.addMainContent(getContentsList(deprAPI));
String memberTableSummary;
Content content = new ContentBuilder();
for (DeprElementKind kind : DeprElementKind.values()) {
if (deprAPI.hasDocumentation(kind)) {
memberTableSummary = resources.getText("doclet.Member_Table_Summary",
resources.getText(getHeadingKey(kind)),
resources.getText(getSummaryKey(kind)));
TableHeader memberTableHeader = new TableHeader(
contents.getContent(getHeaderKey(kind)), contents.descriptionLabel);
addDeprecatedAPI(deprAPI.getSet(kind), getAnchorName(kind),
getHeadingKey(kind), memberTableSummary, memberTableHeader, content);
getHeadingKey(kind), memberTableHeader, content);
}
}
bodyContents.addMainContent(content);
@ -368,12 +364,11 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
* @param deprList list of deprecated API elements
* @param id the id attribute of the table
* @param headingKey the caption for the deprecated table
* @param tableSummary the summary for the deprecated table
* @param tableHeader table headers for the deprecated table
* @param contentTree the content tree to which the deprecated table will be added
*/
protected void addDeprecatedAPI(SortedSet<Element> deprList, String id, String headingKey,
String tableSummary, TableHeader tableHeader, Content contentTree) {
TableHeader tableHeader, Content contentTree) {
if (deprList.size() > 0) {
Content caption = contents.getContent(headingKey);
Table table = new Table(HtmlStyle.summaryTable)

@ -32,7 +32,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.lang.model.element.Element;
import javax.lang.model.element.PackageElement;
@ -118,7 +120,7 @@ public class HtmlConfiguration extends BaseConfiguration {
*/
protected DeprecatedAPIListBuilder deprecatedAPIListBuilder;
public final Contents contents;
private Contents contents;
protected final Messages messages;
@ -181,7 +183,6 @@ public class HtmlConfiguration extends BaseConfiguration {
}
messages = new Messages(this, msgResources);
contents = new Contents(this);
options = new HtmlOptions(this);
Runtime.Version v;
@ -195,6 +196,11 @@ public class HtmlConfiguration extends BaseConfiguration {
conditionalPages = EnumSet.noneOf(ConditionalPage.class);
}
protected void initConfiguration(DocletEnvironment docEnv,
Function<String, String> resourceKeyMapper) {
super.initConfiguration(docEnv, resourceKeyMapper);
contents = new Contents(this);
}
private final Runtime.Version docletVersion;
public final Date startTime = new Date();
@ -215,7 +221,7 @@ public class HtmlConfiguration extends BaseConfiguration {
* @return a utility object providing commonly used fragments of content
*/
public Contents getContents() {
return contents;
return Objects.requireNonNull(contents);
}
@Override

@ -26,12 +26,15 @@
package jdk.javadoc.internal.doclets.formats.html;
import java.util.*;
import java.util.function.Function;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import jdk.javadoc.doclet.Doclet;
import jdk.javadoc.doclet.DocletEnvironment;
import jdk.javadoc.doclet.Reporter;
import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet;
import jdk.javadoc.internal.doclets.toolkit.DocletException;
@ -115,6 +118,52 @@ public class HtmlDoclet extends AbstractDoclet {
return configuration;
}
@Override
protected Function<String, String> getResourceKeyMapper(DocletEnvironment docEnv) {
SourceVersion sv = docEnv.getSourceVersion();
Map<String, String> map = new HashMap<>();
String[][] pairs = {
// in standard.properties
{ "doclet.Enum_Hierarchy", "doclet.Enum_Class_Hierarchy" },
{ "doclet.Annotation_Type_Hierarchy", "doclet.Annotation_Interface_Hierarchy" },
{ "doclet.Href_Enum_Title", "doclet.Href_Enum_Class_Title" },
{ "doclet.Annotation_Types", "doclet.Annotation_Interfaces" },
{ "doclet.Annotation_Type_Members", "doclet.Annotation_Interface_Members" },
{ "doclet.annotation_types", "doclet.annotation_interfaces" },
{ "doclet.annotation_type_members", "doclet.annotation_interface_members" },
{ "doclet.help.enum.intro", "doclet.help.enum.class.intro" },
{ "doclet.help.annotation_type.intro", "doclet.help.annotation_interface.intro" },
{ "doclet.help.annotation_type.declaration", "doclet.help.annotation_interface.declaration" },
{ "doclet.help.annotation_type.description", "doclet.help.annotation_interface.description" },
// in doclets.properties
{ "doclet.Annotation_Types_Summary", "doclet.Annotation_Interfaces_Summary" },
{ "doclet.Enum_Summary", "doclet.Enum_Class_Summary" },
{ "doclet.Enums", "doclet.EnumClasses" },
{ "doclet.AnnotationType", "doclet.AnnotationInterface" },
{ "doclet.AnnotationTypes", "doclet.AnnotationInterfaces" },
{ "doclet.annotationtype", "doclet.annotationinterface" },
{ "doclet.annotationtypes", "doclet.annotationinterfaces" },
{ "doclet.Enum", "doclet.EnumClass" },
{ "doclet.enum", "doclet.enumclass" },
{ "doclet.enums", "doclet.enumclasses" },
{ "doclet.Annotation_Type_Member", "doclet.Annotation_Interface_Member" },
{ "doclet.enum_values_doc.fullbody", "doclet.enum_class_values_doc.fullbody" },
{ "doclet.enum_values_doc.return", "doclet.enum_class_values_doc.return" },
{ "doclet.enum_valueof_doc.fullbody", "doclet.enum_class_valueof_doc.fullbody" },
{ "doclet.enum_valueof_doc.throws_ila", "doclet.enum_class_valueof_doc.throws_ila" },
{ "doclet.search.types", "doclet.search.classes_and_interfaces"}
};
for (String[] pair : pairs) {
if (sv.compareTo(SourceVersion.RELEASE_16) >= 0) {
map.put(pair[0], pair[1]);
} else {
map.put(pair[1], pair[0]);
}
}
return (k) -> map.getOrDefault(k, k);
}
@Override // defined by AbstractDoclet
public void generateClassFiles(ClassTree classTree) throws DocletException {

@ -216,7 +216,7 @@ public class HtmlDocletWriter {
public HtmlDocletWriter(HtmlConfiguration configuration, DocPath path) {
this.configuration = configuration;
this.options = configuration.getOptions();
this.contents = configuration.contents;
this.contents = configuration.getContents();
this.messages = configuration.messages;
this.resources = configuration.docResources;
this.links = new Links(path, configuration.utils);

@ -97,12 +97,24 @@ public class MarkerComments {
public static final Comment START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY =
new Comment("=========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY ===========");
/**
* Marker to identify start of annotation interface optional member summary.
*/
public static final Comment START_OF_ANNOTATION_INTERFACE_OPTIONAL_MEMBER_SUMMARY =
new Comment("=========== ANNOTATION INTERFACE OPTIONAL MEMBER SUMMARY ===========");
/**
* Marker to identify start of annotation type required member summary.
*/
public static final Comment START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY =
new Comment("=========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY ===========");
/**
* Marker to identify start of annotation interface required member summary.
*/
public static final Comment START_OF_ANNOTATION_INTERFACE_REQUIRED_MEMBER_SUMMARY =
new Comment("=========== ANNOTATION INTERFACE REQUIRED MEMBER SUMMARY ===========");
/**
* Marker to identify start of constructor summary.
*/
@ -140,10 +152,10 @@ public class MarkerComments {
new Comment("============ ANNOTATION TYPE MEMBER DETAIL ===========");
/**
* Marker to identify start of annotation type field details.
* Marker to identify start of annotation interface details.
*/
public static final Comment START_OF_ANNOTATION_TYPE_FIELD_DETAILS =
new Comment("============ ANNOTATION TYPE FIELD DETAIL ===========");
public static final Comment START_OF_ANNOTATION_INTERFACE_DETAILS =
new Comment("============ ANNOTATION INTERFACE MEMBER DETAIL ===========");
/**
* Marker to identify start of method details.

@ -481,9 +481,6 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
addSummaryHeader(MarkerComments.START_OF_MODULES_SUMMARY, contents.navModules, section);
if (display(requires)) {
String text = resources.getText("doclet.Requires_Summary");
String tableSummary = resources.getText("doclet.Member_Table_Summary",
text,
resources.getText("doclet.modules"));
Content caption = new StringContent(text);
Table table = getTable3(caption, requiresTableHeader);
addModulesList(requires, table);
@ -492,9 +489,6 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
// Display indirect modules table in both "api" and "all" mode.
if (display(indirectModules)) {
String amrText = resources.getText("doclet.Indirect_Requires_Summary");
String amrTableSummary = resources.getText("doclet.Member_Table_Summary",
amrText,
resources.getText("doclet.modules"));
Content amrCaption = new StringContent(amrText);
Table amrTable = getTable3(amrCaption, requiresTableHeader);
addModulesList(indirectModules, amrTable);

@ -116,7 +116,7 @@ public class Navigation {
this.configuration = configuration;
this.options = configuration.getOptions();
this.element = element;
this.contents = configuration.contents;
this.contents = configuration.getContents();
this.documentedPage = page;
this.path = path;
this.pathToRoot = path.parent().invert();

@ -61,7 +61,6 @@ public class PackageUseWriter extends SubWriterHolderWriter {
final PackageElement packageElement;
final SortedMap<String, Set<TypeElement>> usingPackageToUsedClasses = new TreeMap<>();
final String packageUseTableSummary;
/**
* Constructor.
@ -96,9 +95,6 @@ public class PackageUseWriter extends SubWriterHolderWriter {
}
}
}
packageUseTableSummary = resources.getText("doclet.Use_Table_Summary",
resources.getText("doclet.packages"));
}
/**
@ -193,8 +189,6 @@ public class PackageUseWriter extends SubWriterHolderWriter {
PackageElement usingPackage = utils.elementUtils.getPackageElement(packageName);
HtmlTree section = HtmlTree.SECTION(HtmlStyle.detail)
.setId(getPackageAnchorName(usingPackage));
String tableSummary = resources.getText("doclet.Use_Table_Summary",
resources.getText("doclet.classes"));
Content caption = contents.getContent(
"doclet.ClassUse_Classes.in.0.used.by.1",
getPackageLink(packageElement, utils.getPackageName(packageElement)),

@ -164,43 +164,43 @@ public class PackageWriterImpl extends HtmlDocletWriter
@Override
public void addInterfaceSummary(SortedSet<TypeElement> interfaces, Content summaryContentTree) {
TableHeader tableHeader= new TableHeader(contents.interfaceLabel, contents.descriptionLabel);
addClassesSummary(interfaces, resources.interfaceSummary, tableHeader, summaryContentTree);
addClassesSummary(interfaces, contents.interfaceSummary, tableHeader, summaryContentTree);
}
@Override
public void addClassSummary(SortedSet<TypeElement> classes, Content summaryContentTree) {
TableHeader tableHeader= new TableHeader(contents.classLabel, contents.descriptionLabel);
addClassesSummary(classes, resources.classSummary, tableHeader, summaryContentTree);
addClassesSummary(classes, contents.classSummary, tableHeader, summaryContentTree);
}
@Override
public void addEnumSummary(SortedSet<TypeElement> enums, Content summaryContentTree) {
TableHeader tableHeader= new TableHeader(contents.enum_, contents.descriptionLabel);
addClassesSummary(enums, resources.enumSummary, tableHeader, summaryContentTree);
addClassesSummary(enums, contents.enumSummary, tableHeader, summaryContentTree);
}
@Override
public void addRecordSummary(SortedSet<TypeElement> records, Content summaryContentTree) {
TableHeader tableHeader= new TableHeader(contents.record, contents.descriptionLabel);
addClassesSummary(records, resources.recordSummary, tableHeader, summaryContentTree);
addClassesSummary(records, contents.recordSummary, tableHeader, summaryContentTree);
}
@Override
public void addExceptionSummary(SortedSet<TypeElement> exceptions, Content summaryContentTree) {
TableHeader tableHeader= new TableHeader(contents.exception, contents.descriptionLabel);
addClassesSummary(exceptions, resources.exceptionSummary, tableHeader, summaryContentTree);
addClassesSummary(exceptions, contents.exceptionSummary, tableHeader, summaryContentTree);
}
@Override
public void addErrorSummary(SortedSet<TypeElement> errors, Content summaryContentTree) {
TableHeader tableHeader= new TableHeader(contents.error, contents.descriptionLabel);
addClassesSummary(errors, resources.errorSummary, tableHeader, summaryContentTree);
addClassesSummary(errors, contents.errorSummary, tableHeader, summaryContentTree);
}
@Override
public void addAnnotationTypeSummary(SortedSet<TypeElement> annoTypes, Content summaryContentTree) {
TableHeader tableHeader= new TableHeader(contents.annotationType, contents.descriptionLabel);
addClassesSummary(annoTypes, resources.annotationTypeSummary, tableHeader, summaryContentTree);
addClassesSummary(annoTypes, contents.annotationTypeSummary, tableHeader, summaryContentTree);
}
public void addClassesSummary(SortedSet<TypeElement> classes, String label,

@ -35,9 +35,9 @@ package jdk.javadoc.internal.doclets.formats.html;
*/
public enum SectionName {
ANNOTATION_TYPE_ELEMENT_DETAIL("annotation.type.element.detail"),
ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY("annotation.type.optional.element.summary"),
ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY("annotation.type.required.element.summary"),
ANNOTATION_TYPE_ELEMENT_DETAIL("annotation.interface.element.detail"),
ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY("annotation.interface.optional.element.summary"),
ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY("annotation.interface.required.element.summary"),
CONSTRUCTOR_DETAIL("constructor.detail"),
CONSTRUCTOR_SUMMARY("constructor.summary"),
ENUM_CONSTANT_DETAIL("enum.constant.detail"),

@ -39,11 +39,14 @@ doclet.Class_Hierarchy=Class Hierarchy
doclet.Window_Class_Hierarchy=Class Hierarchy
doclet.Interface_Hierarchy=Interface Hierarchy
doclet.Enum_Hierarchy=Enum Hierarchy
doclet.Enum_Class_Hierarchy=Enum Class Hierarchy
doclet.Annotation_Type_Hierarchy=Annotation Type Hierarchy
doclet.Annotation_Interface_Hierarchy=Annotation Interface Hierarchy
doclet.Href_Class_Title=class in {0}
doclet.Href_Interface_Title=interface in {0}
doclet.Href_Annotation_Title=annotation in {0}
doclet.Href_Enum_Title=enum in {0}
doclet.Href_Enum_Class_Title=enum class in {0}
doclet.Href_Type_Param_Title=type parameter in {0}
doclet.Href_Class_Or_Interface_Title=class or interface in {0}
doclet.Summary=Summary:
@ -95,10 +98,14 @@ doclet.tag.invalid_usage=invalid usage of tag {0}
doclet.Deprecated_API=Deprecated API
doclet.For_Removal=For Removal
doclet.Annotation_Types=Annotation Types
doclet.Annotation_Interfaces=Annotation Interfaces
doclet.Annotation_Type_Members=Annotation Type Elements
doclet.Annotation_Interface_Members=Annotation Interface Elements
doclet.for_removal=for removal
doclet.annotation_types=annotation types
doclet.annotation_interfaces=annotation interfaces
doclet.annotation_type_members=annotation type elements
doclet.annotation_interface_members=annotation interface elements
doclet.record_classes=record classes
doclet.Generated_Docs_Untitled=Generated Documentation (Untitled)
doclet.Other_Packages=Other Packages
@ -212,16 +219,24 @@ doclet.help.footnote=\
This help file applies to API documentation generated by the standard doclet.
doclet.help.enum.intro=\
Each enum has its own separate page with the following sections:
doclet.help.enum.class.intro=\
Each enum class has its own separate page with the following sections:
doclet.help.enum.declaration=\
Enum Declaration
doclet.help.enum.definition=\
Enum Description
doclet.help.annotation_type.intro=\
Each annotation type has its own separate page with the following sections:
doclet.help.annotation_interface.intro=\
Each annotation interface has its own separate page with the following sections:
doclet.help.annotation_type.declaration=\
Annotation Type Declaration
doclet.help.annotation_interface.declaration=\
Annotation Interface Declaration
doclet.help.annotation_type.description=\
Annotation Type Description
doclet.help.annotation_interface.description=\
Annotation Interface Description
doclet.help.search.head=Search
# Introduction to Javadoc search features, followed by a list of examples
doclet.help.search.intro=You can search for definitions of modules, packages, types, fields, methods, \

@ -25,8 +25,10 @@
package jdk.javadoc.internal.doclets.toolkit;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.function.Function;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.PackageElement;
@ -99,7 +101,7 @@ public abstract class AbstractDoclet implements Doclet {
@Override
public boolean run(DocletEnvironment docEnv) {
configuration = getConfiguration();
configuration.initConfiguration(docEnv);
configuration.initConfiguration(docEnv, getResourceKeyMapper(docEnv));
utils = configuration.utils;
messages = configuration.getMessages();
BaseOptions options = configuration.getOptions();
@ -149,6 +151,10 @@ public abstract class AbstractDoclet implements Doclet {
return false;
}
protected Function<String, String> getResourceKeyMapper(DocletEnvironment docEnv) {
return null;
}
private void reportInternalError(Throwable t) {
if (getClass().equals(StandardDoclet.class) || getClass().equals(HtmlDoclet.class)) {
System.err.println(configuration.getDocResources().getText("doclet.internal.report.bug"));

@ -41,6 +41,7 @@ import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.function.Function;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
@ -237,7 +238,8 @@ public abstract class BaseConfiguration {
private boolean initialized = false;
protected void initConfiguration(DocletEnvironment docEnv) {
protected void initConfiguration(DocletEnvironment docEnv,
Function<String, String> resourceKeyMapper) {
if (initialized) {
throw new IllegalStateException("configuration previously initialized");
}
@ -251,6 +253,8 @@ public abstract class BaseConfiguration {
options.setJavaFX(isJavaFXMode());
}
getDocResources().setKeyMapper(resourceKeyMapper);
// Once docEnv and Utils have been initialized, others should be safe.
metakeywords = new MetaKeywords(this);
cmtUtils = new CommentUtils(this);

@ -29,6 +29,7 @@ import java.text.MessageFormat;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.function.Function;
/**
* Access to the localizable resources used by a doclet.
@ -39,17 +40,10 @@ import java.util.ResourceBundle;
* HTML doclet.
*/
public class Resources {
public final String annotationTypeSummary;
public final String classSummary;
public final String enumSummary;
public final String errorSummary;
public final String exceptionSummary;
public final String interfaceSummary;
public final String packageSummary;
public final String recordSummary;
protected ResourceBundle commonBundle;
protected ResourceBundle docletBundle;
protected final ResourceBundle commonBundle;
protected final ResourceBundle docletBundle;
protected Function<String, String> mapper;
/**
* Creates a {@code Resources} object to provide access the resource
@ -65,20 +59,17 @@ public class Resources {
public Resources(Locale locale, String commonBundleName, String docletBundleName) {
this.commonBundle = ResourceBundle.getBundle(commonBundleName, locale);
this.docletBundle = ResourceBundle.getBundle(docletBundleName, locale);
}
this.annotationTypeSummary = getText("doclet.Annotation_Types_Summary");
this.classSummary = getText("doclet.Class_Summary");
this.enumSummary = getText("doclet.Enum_Summary");
this.errorSummary = getText("doclet.Error_Summary");
this.exceptionSummary = getText("doclet.Exception_Summary");
this.interfaceSummary = getText("doclet.Interface_Summary");
this.packageSummary = getText("doclet.Package_Summary");
this.recordSummary = getText("doclet.Record_Summary");
public void setKeyMapper(Function<String, String> mapper) {
this.mapper = mapper;
}
/**
* Returns the string for the given key from one of the doclet's
* resource bundles.
* resource bundles. If the current {@code mapper} is not {@code null},
* it will be applied to the {@code key} before looking up the resulting
* key in the resource bundle(s).
*
* The more specific bundle is checked first;
* if it is not there, the common bundle is then checked.
@ -89,13 +80,17 @@ public class Resources {
* bundle.
*/
public String getText(String key) throws MissingResourceException {
if (docletBundle.containsKey(key))
return docletBundle.getString(key);
String mKey = mapper == null ? key : mapper.apply(key);
return commonBundle.getString(key);
if (docletBundle.containsKey(mKey))
return docletBundle.getString(mKey);
return commonBundle.getString(mKey);
}
/**
* Returns the string for the given key from one of the doclet's
* Returns the string for the given key (after applying the current
* {@code mapper} if it is not {@code null}) from one of the doclet's
* resource bundles, substituting additional arguments into
* into the resulting string with {@link MessageFormat#format}.
*

@ -128,7 +128,7 @@ public class ClassBuilder extends AbstractBuilder {
key = "doclet.Enum";
break;
case RECORD:
key = "doclet.Record";
key = "doclet.RecordClass";
break;
case ANNOTATION_TYPE:
key = "doclet.AnnotationType";

@ -127,7 +127,9 @@ doclet.Uses_Summary=Uses
doclet.Provides_Summary=Provides
doclet.Interface_Summary=Interface Summary
doclet.Annotation_Types_Summary=Annotation Types Summary
doclet.Annotation_Interfaces_Summary=Annotation Interfaces Summary
doclet.Enum_Summary=Enum Summary
doclet.Enum_Class_Summary=Enum Class Summary
doclet.Exception_Summary=Exception Summary
doclet.Error_Summary=Error Summary
doclet.Class_Summary=Class Summary
@ -139,11 +141,13 @@ doclet.Property_Summary=Property Summary
doclet.Enum_Constant_Summary=Enum Constant Summary
doclet.Constructor_Summary=Constructor Summary
doclet.Method_Summary=Method Summary
doclet.Record_Summary=Record Summary
doclet.Record_Class_Summary=Record Class Summary
doclet.Interfaces=Interfaces
doclet.Enums=Enums
doclet.EnumClasses=Enum Classes
doclet.RecordClasses=Record Classes
doclet.AnnotationTypes=Annotation Types
doclet.AnnotationInterfaces=Annotation Interfaces
doclet.Exceptions=Exceptions
doclet.Errors=Errors
doclet.Classes=Classes
@ -155,17 +159,23 @@ doclet.All_Implemented_Interfaces=All Implemented Interfaces:
doclet.Interface=Interface
doclet.Class=Class
doclet.AnnotationType=Annotation Type
doclet.AnnotationInterface=Annotation Interface
doclet.annotationtype=annotation type
doclet.annotationinterface=annotation interface
doclet.annotationtypes=annotation types
doclet.annotationinterfaces=annotation interfaces
doclet.Enum=Enum
doclet.EnumClass=Enum Class
doclet.enum=enum
doclet.enumclass=enum class
doclet.enums=enums
doclet.enumclasses=enum classes
doclet.interface=interface
doclet.interfaces=interfaces
doclet.class=class
doclet.classes=classes
doclet.Record=Record
doclet.record=record
doclet.RecordClass=Record Class
doclet.recordclass=record class
doclet.Error=Error
doclet.error=error
doclet.errors=errors
@ -206,8 +216,6 @@ doclet.value_tag_invalid_constant=@value tag (which references {0}) can only be
doclet.value_tag_invalid_use=@value tag cannot be used here.
doclet.dest_dir_create=Creating destination directory: "{0}"
doclet.in={0} in {1}
doclet.Use_Table_Summary=Use table, listing {0}, and an explanation
doclet.Member_Table_Summary={0} table, listing {1}, and an explanation
doclet.fields=fields
doclet.Fields=Fields
doclet.Properties=Properties
@ -239,6 +247,7 @@ doclet.Method=Method
doclet.Annotation_Type_Optional_Member=Optional Element
doclet.Annotation_Type_Required_Member=Required Element
doclet.Annotation_Type_Member=Annotation Type Element
doclet.Annotation_Interface_Member=Annotation Interface Element
doclet.Enum_Constant=Enum Constant
doclet.Description=Description
doclet.ConstantField=Constant Field
@ -253,15 +262,25 @@ doclet.urlRedirected=URL {0} was redirected to {1} -- Update the command-line op
doclet.enum_values_doc.fullbody=\
Returns an array containing the constants of this enum type, in\n\
the order they are declared.
doclet.enum_class_values_doc.fullbody=\
Returns an array containing the constants of this enum class, in\n\
the order they are declared.
doclet.enum_values_doc.return=\
an array containing the constants of this enum type, in the order they are declared
doclet.enum_class_values_doc.return=\
an array containing the constants of this enum class, in the order they are declared
doclet.enum_valueof_doc.fullbody=\
Returns the enum constant of this type with the specified name.\n\
The string must match <i>exactly</i> an identifier used to declare an\n\
enum constant in this type. (Extraneous whitespace characters are \n\
not permitted.)
doclet.enum_class_valueof_doc.fullbody=\
Returns the enum constant of this class with the specified name.\n\
The string must match <i>exactly</i> an identifier used to declare an\n\
enum constant in this class. (Extraneous whitespace characters are \n\
not permitted.)
doclet.enum_valueof_doc.param_name=\
the name of the enum constant to be returned.
@ -271,6 +290,8 @@ doclet.enum_valueof_doc.return=\
doclet.enum_valueof_doc.throws_ila=\
if this enum type has no constant with the specified name
doclet.enum_class_valueof_doc.throws_ila=\
if this enum class has no constant with the specified name
doclet.enum_valueof_doc.throws_npe=\
if the argument is null
@ -278,7 +299,7 @@ doclet.enum_valueof_doc.throws_npe=\
#Documentation for records
doclet.record_constructor_doc.fullbody=\
Creates an instance of a {0} record.
Creates an instance of a {0} record class.
doclet.record_constructor_doc.param_name=\
the value for the {0} record component
@ -294,10 +315,10 @@ doclet.record_equals_doc.fullbody.tail.both=\
primitive components are compared with '=='.
doclet.record_equals_doc.fullbody.tail.primitive=\
All components in this record are compared with '=='.
All components in this record class are compared with '=='.
doclet.record_equals_doc.fullbody.tail.reference=\
All components in this record are compared with \
All components in this record class are compared with \
{@link java.util.Objects#equals(Object,Object) Objects::equals(Object,Object)}.
doclet.record_equals_doc.param_name=\
@ -314,8 +335,8 @@ doclet.record_hashCode_doc.return=\
a hash code value for this object
doclet.record_toString_doc.fullbody=\
Returns a string representation of this record. \
The representation contains the name of the type, followed by \
Returns a string representation of this record class. \
The representation contains the name of the class, followed by \
the name and value of each of the record components.
doclet.record_toString_doc.return=\
@ -338,6 +359,7 @@ doclet.search.no_results=No results found
doclet.search.loading=Loading search index...
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

@ -1362,7 +1362,7 @@ public class Utils {
case INTERFACE ->
"doclet.Interface";
case RECORD ->
"doclet.Record";
"doclet.RecordClass";
case CLASS ->
isException(te) ? "doclet.Exception"
: isError(te) ? "doclet.Error"

@ -50,6 +50,6 @@ public class TestAnnotationOptional extends JavadocTester {
checkOutput("pkg/AnnotationOptional.html", true,
"""
<section class="details" id="annotation.type.element.detail">""");
<section class="details" id="annotation.interface.element.detail">""");
}
}

@ -79,11 +79,11 @@ public class TestAnnotationTypes extends JavadocTester {
<li>Field&nbsp;|&nbsp;</li>""");
checkOutput("pkg/AnnotationType.html", true,
"<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->",
"<!-- ============ ANNOTATION INTERFACE MEMBER DETAIL =========== -->",
"<ul class=\"member-list\">",
"<li>",
"""
<section class="details" id="annotation.type.element.detail">""",
<section class="details" id="annotation.interface.element.detail">""",
"<h2>Element Details</h2>",
"<!-- -->",
"</a>",

@ -57,21 +57,21 @@ public class TestClassTree extends JavadocTester {
<li class="circle">pkg.<a href="ParentClass.html" title="class in pkg"><span cla\
ss="type-name-link">ParentClass</span></a>""",
"""
<h2 title="Annotation Type Hierarchy">Annotation Type Hierarchy</h2>
<h2 title="Annotation Interface Hierarchy">Annotation Interface Hierarchy</h2>
<ul>
<li class="circle">pkg.<a href="AnnotationType.html" title="annotation in pkg"><\
span class="type-name-link">AnnotationType</span></a> (implements java.lang.anno\
tation.Annotation)</li>
</ul>""",
"""
<h2 title="Enum Hierarchy">Enum Hierarchy</h2>
<h2 title="Enum Class Hierarchy">Enum Class Hierarchy</h2>
<ul>
<li class="circle">java.lang.Object
<ul>
<li class="circle">java.lang.Enum&lt;E&gt; (implements java.lang.Comparable&lt;T\
&gt;, java.lang.constant.Constable, java.io.Serializable)
<ul>
<li class="circle">pkg.<a href="Coin.html" title="enum in pkg"><span class="type-name-link">Coin</span></a></li>
<li class="circle">pkg.<a href="Coin.html" title="enum class in pkg"><span class="type-name-link">Coin</span></a></li>
</ul>
</li>
</ul>

@ -216,7 +216,7 @@ public class TestDeprecatedDocs extends JavadocTester {
<div class="type-signature"><span class="annotations">@Deprecated(forRemoval=true)
</span><span class="modifiers">public enum </span><span class="element-name type-name-label">TestEnum</span>
<span class="extends-implements">extends java.lang.Enum&lt;<a href="TestEnum.htm\
l" title="enum in pkg">TestEnum</a>&gt;</span></div>
l" title="enum class in pkg">TestEnum</a>&gt;</span></div>
<div class="deprecation-block"><span class="deprecated-label">Deprecated, for re\
moval: This API element is subject to removal in a future version.</span>
<div class="deprecation-comment">enum_test1 passes.</div>
@ -224,7 +224,7 @@ public class TestDeprecatedDocs extends JavadocTester {
"""
<div class="member-signature"><span class="annotations">@Deprecated(forRemoval=true)
</span><span class="modifiers">public static final</span>&nbsp;<span class="retu\
rn-type"><a href="TestEnum.html" title="enum in pkg">TestEnum</a></span>&nbsp;<s\
rn-type"><a href="TestEnum.html" title="enum class in pkg">TestEnum</a></span>&nbsp;<s\
pan class="element-name">FOR_REMOVAL</span></div>
<div class="deprecation-block"><span class="deprecated-label">Deprecated, for re\
moval: This API element is subject to removal in a future version.</span>
@ -269,15 +269,15 @@ public class TestDeprecatedDocs extends JavadocTester {
<ul>
<li><a href="#forRemoval">For Removal</a></li>
<li><a href="#class">Classes</a></li>
<li><a href="#enum">Enums</a></li>
<li><a href="#enum.class">Enum Classes</a></li>
<li><a href="#exception">Exceptions</a></li>
<li><a href="#error">Errors</a></li>
<li><a href="#annotation.type">Annotation Types</a></li>
<li><a href="#annotation.interface">Annotation Interfaces</a></li>
<li><a href="#field">Fields</a></li>
<li><a href="#method">Methods</a></li>
<li><a href="#constructor">Constructors</a></li>
<li><a href="#enum.constant">Enum Constants</a></li>
<li><a href="#annotation.type.member">Annotation Type Elements</a></li>
<li><a href="#annotation.interface.member">Annotation Interface Elements</a></li>
</ul>""",
"""
<div id="forRemoval">
@ -286,12 +286,12 @@ public class TestDeprecatedDocs extends JavadocTester {
<div class="table-header col-first">Element</div>
<div class="table-header col-last">Description</div>""",
"""
<div id="enum">
<div class="caption"><span>Enums</span></div>
<div id="enum.class">
<div class="caption"><span>Enum Classes</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Enum</div>
<div class="table-header col-first">Enum Class</div>
<div class="table-header col-last">Description</div>
<div class="col-deprecated-item-name even-row-color"><a href="pkg/TestEnum.html" title="enum in pkg">pkg.TestEnum</a></div>
<div class="col-deprecated-item-name even-row-color"><a href="pkg/TestEnum.html" title="enum class in pkg">pkg.TestEnum</a></div>
<div class="col-last even-row-color">
<div class="deprecation-comment">enum_test1 passes.</div>
</div>""",

@ -63,7 +63,7 @@ public class TestHelpFile extends JavadocTester {
<ul class="help-section-list">
<li>Interfaces</li>
<li>Classes</li>
<li>Enums</li>""",
<li>Enum Classes</li>""",
"""
</section>
<section class="help-section">

@ -353,7 +353,7 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
"""
<div class="member-signature"><span class="modifiers">public static final</span>\
&nbsp;<span class="return-type"><a href="C1.ModalExclusionType.html" title="enum\
in pkg1">C1.ModalExclusionType</a></span>&nbsp;<span class="element-name">APPLICATION_E\
class in pkg1">C1.ModalExclusionType</a></span>&nbsp;<span class="element-name">APPLICATION_E\
XCLUDE</span></div>
</section>
</li>""");

@ -191,10 +191,10 @@ public class TestHtmlTableTags extends JavadocTester {
checkOutput("pkg2/package-summary.html", true,
"""
<div class="type-summary">
<table summary="Enum Summary table, listing enums, and an explanation">""",
<table summary="Enum Class Summary table, listing enums, and an explanation">""",
"""
<div class="type-summary">
<table summary="Annotation Types Summary table, listing annotation types, and an explanation">""");
<table summary="Annotation Interfaces Summary table, listing annotation types, and an explanation">""");
// Class documentation
checkOutput("pkg1/C1.html", true,
@ -309,8 +309,8 @@ public class TestHtmlTableTags extends JavadocTester {
"<div class=\"caption\"><span>Interface Summary</span></div>");
checkOutput("pkg2/package-summary.html", true,
"<div class=\"caption\"><span>Enum Summary</span></div>",
"<div class=\"caption\"><span>Annotation Types Summary</span></div>");
"<div class=\"caption\"><span>Enum Class Summary</span></div>",
"<div class=\"caption\"><span>Annotation Interfaces Summary</span></div>");
// Class documentation
checkOutput("pkg1/C1.html", true,
@ -373,7 +373,7 @@ public class TestHtmlTableTags extends JavadocTester {
checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
"""
<div class="caption"><span>Methods in <a href="../package-summary.html">pkg2</a> that return\
<a href="../C2.ModalExclusionType.html" title="enum in pkg2">C2.ModalExclusionT\
<a href="../C2.ModalExclusionType.html" title="enum class in pkg2">C2.ModalExclusionT\
ype</a></span></div>""");
// Package use documentation
@ -421,10 +421,10 @@ public class TestHtmlTableTags extends JavadocTester {
checkOutput("pkg2/package-summary.html", true,
"""
<div class="table-header col-first">Enum</div>
<div class="table-header col-first">Enum Class</div>
<div class="table-header col-last">Description</div>""",
"""
<div class="table-header col-first">Annotation Type</div>
<div class="table-header col-first">Annotation Interface</div>
<div class="table-header col-last">Description</div>""");
// Class documentation
@ -558,7 +558,7 @@ public class TestHtmlTableTags extends JavadocTester {
checkOutput("pkg2/package-summary.html", true,
"""
<div class="col-first even-row-color"><a href="C2.ModalExclusionType.html" title="enum in pkg2">C2.ModalExclusionType</a></div>
<div class="col-first even-row-color"><a href="C2.ModalExclusionType.html" title="enum class in pkg2">C2.ModalExclusionType</a></div>
<div class="col-last even-row-color">
<div class="block">A sample enum.</div>
</div>""",
@ -715,7 +715,7 @@ public class TestHtmlTableTags extends JavadocTester {
checkOutput("pkg2/package-summary.html", true,
"""
<div class="col-first even-row-color"><a href="C2.ModalExclusionType.html" title="enum in pkg2">C2.ModalExclusionType</a></div>
<div class="col-first even-row-color"><a href="C2.ModalExclusionType.html" title="enum class in pkg2">C2.ModalExclusionType</a></div>
<div class="col-last even-row-color"></div>""",
"""
<div class="col-first even-row-color"><a href="C3.html" title="annotation in pkg2">C3</a></div>

@ -144,10 +144,10 @@ public class TestHtmlVersion extends JavadocTester {
<h2 title="Interface Hierarchy">Interface Hierarchy</h2>""",
"""
<section class="hierarchy">
<h2 title="Annotation Type Hierarchy">Annotation Type Hierarchy</h2>""",
<h2 title="Annotation Interface Hierarchy">Annotation Interface Hierarchy</h2>""",
"""
<section class="hierarchy">
<h2 title="Enum Hierarchy">Enum Hierarchy</h2>""",
<h2 title="Enum Class Hierarchy">Enum Class Hierarchy</h2>""",
"""
<footer role="contentinfo">""",
"""
@ -272,11 +272,11 @@ public class TestHtmlVersion extends JavadocTester {
""",
"""
<section class="hierarchy">
<h2 title="Annotation Type Hierarchy">Annotation Type Hierarchy</h2>
<h2 title="Annotation Interface Hierarchy">Annotation Interface Hierarchy</h2>
""",
"""
<section class="hierarchy">
<h2 title="Enum Hierarchy">Enum Hierarchy</h2>
<h2 title="Enum Class Hierarchy">Enum Class Hierarchy</h2>
""",
"""
<footer role="contentinfo">""",
@ -534,19 +534,19 @@ public class TestHtmlVersion extends JavadocTester {
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">""",
"""
<section class="member-summary" id="annotation.type.required.element.summary">
<section class="member-summary" id="annotation.interface.required.element.summary">
<h2>Required Element Summary</h2>
<div class="caption"><span>Required Elements</span></div>
<div class="summary-table three-column-summary">""",
"""
<section class="member-summary" id="annotation.type.optional.element.summary">
<section class="member-summary" id="annotation.interface.optional.element.summary">
<h2>Optional Element Summary</h2>
<div class="caption"><span>Optional Elements</span></div>
<div class="summary-table three-column-summary">""",
"""
<section class="details" id="annotation.type.element.detail">
<section class="details" id="annotation.interface.element.detail">
<ul class="details-list">
<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
<!-- ============ ANNOTATION INTERFACE MEMBER DETAIL =========== -->
<li>
<section class="member-details">
<h2>Element Details</h2>
@ -759,7 +759,7 @@ public class TestHtmlVersion extends JavadocTester {
<h2 title="Interface Hierarchy">Interface Hierarchy</h2>""",
"""
</ul>
<h2 title="Enum Hierarchy">Enum Hierarchy</h2>""");
<h2 title="Enum Class Hierarchy">Enum Class Hierarchy</h2>""");
// Negated test for index-all page
checkOutput("index-all.html", false,

@ -60,11 +60,11 @@ public class TestIndex extends JavadocTester {
>""",
"""
<a href="pkg/AnnotationType.html" title="annotation in pkg"><span class="type-na\
me-link">AnnotationType</span></a> - Annotation Type in <a href="pkg/package-sum\
me-link">AnnotationType</span></a> - Annotation Interface in <a href="pkg/package-sum\
mary.html">pkg</a>""",
"""
<a href="pkg/Coin.html" title="enum in pkg"><span class="type-name-link">Coin</s\
pan></a> - Enum in <a href="pkg/package-summary.html">pkg</a>""",
<a href="pkg/Coin.html" title="enum class in pkg"><span class="type-name-link">Coin</s\
pan></a> - Enum Class in <a href="pkg/package-summary.html">pkg</a>""",
"""
Class in <a href="package-summary.html">&lt;Unnamed&gt;</a>""",
"""
@ -77,6 +77,6 @@ public class TestIndex extends JavadocTester {
<dd>&nbsp;</dd>
</dl>""",
"""
<dt><span class="search-tag-link"><a href="pkg/Coin.html#Enum">Enum</a></span> - Search tag in enum pkg.Coin</dt>""");
<dt><span class="search-tag-link"><a href="pkg/Coin.html#Enum">Enum</a></span> - Search tag in enum class pkg.Coin</dt>""");
}
}

@ -171,7 +171,7 @@ public class TestLists extends JavadocTester {
checkOutput("p/A.html", true,
"""
<ul class="details-list">
<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
<!-- ============ ANNOTATION INTERFACE MEMBER DETAIL =========== -->
<li>
<section class="member-details">
<h2>Element Details</h2>
@ -240,9 +240,9 @@ public class TestLists extends JavadocTester {
"""
<section class="summary">
<ul class="summary-list">
<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->
<!-- =========== ANNOTATION INTERFACE REQUIRED MEMBER SUMMARY =========== -->
<li>
<section class="member-summary" id="annotation.type.required.element.summary">
<section class="member-summary" id="annotation.interface.required.element.summary">
<h2>Required Element Summary</h2>
<div class="caption"><span>Required Elements</span></div>
<div class="summary-table three-column-summary">""");

@ -1383,7 +1383,7 @@ public class TestModules extends JavadocTester {
<button id="all-classes-table-tab6" role="tab" aria-selected="false" aria-contro\
ls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" oncli\
ck="show('all-classes-table', 'all-classes-table-tab6', 2)" class="table-tab">An\
notation Types Summary</button>\
notation Interfaces Summary</button>\
</div>
""",
"""

@ -65,31 +65,31 @@ public class TestNewLanguageFeatures extends JavadocTester {
void checkEnums() {
checkOutput("pkg/Coin.html", true,
// Make sure enum header is correct.
"Enum Coin</h1>",
"Enum Class Coin</h1>",
// Make sure enum signature is correct.
"""
<div class="type-signature"><span class="modifiers">public enum </span><span clas\
s="element-name type-name-label">Coin</span>
<span class="extends-implements">extends java.lang.Enum&lt;<a href="Coin.html" ti\
tle="enum in pkg">Coin</a>&gt;</span></div>""",
tle="enum class in pkg">Coin</a>&gt;</span></div>""",
// Check for enum constant section
"<div class=\"caption\"><span>Enum Constants</span></div>",
// Detail for enum constant
"""
<span class="member-name-link"><a href="#Dime">Dime</a></span>""",
// Automatically insert documentation for values() and valueOf().
"Returns an array containing the constants of this enum type,",
"Returns the enum constant of this type with the specified name",
"Returns an array containing the constants of this enum class,",
"Returns the enum constant of this class with the specified name",
"Overloaded valueOf() method has correct documentation.",
"Overloaded values method has correct documentation.",
"""
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;\
<span class="return-type"><a href="Coin.html" title="enum in pkg">Coin</a></span\
<span class="return-type"><a href="Coin.html" title="enum class in pkg">Coin</a></span\
>&nbsp;<span class="element-name">valueOf</span>&#8203;<span class="parameters">(java.la\
ng.String&nbsp;name)</span></div>
<div class="block">Returns the enum constant of this type with the specified name.
<div class="block">Returns the enum constant of this class with the specified name.
The string must match <i>exactly</i> an identifier used to declare an
enum constant in this type. (Extraneous whitespace characters are\s
enum constant in this class. (Extraneous whitespace characters are\s
not permitted.)</div>
<dl class="notes">
<dt>Parameters:</dt>
@ -97,7 +97,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
<dt>Returns:</dt>
<dd>the enum constant with the specified name</dd>
<dt>Throws:</dt>
<dd><code>java.lang.IllegalArgumentException</code> - if this enum type has no constant with the specified name</dd>
<dd><code>java.lang.IllegalArgumentException</code> - if this enum class has no constant with the specified name</dd>
<dd><code>java.lang.NullPointerException</code> - if the argument is null</dd>""");
// NO constructor section

@ -262,12 +262,12 @@ public class TestOptions extends JavadocTester {
checkOutput("linksource/SomeEnum.html", true,
"""
<div class="member-signature"><span class="modifiers">public static final</span>\
&nbsp;<span class="return-type"><a href="SomeEnum.html" title="enum in linksourc\
&nbsp;<span class="return-type"><a href="SomeEnum.html" title="enum class in linksourc\
e">SomeEnum</a></span>&nbsp;<span class="element-name"><a href="../src-html/linksource/S\
omeEnum.html#line.29">VALUE1</a></span></div>""",
"""
<div class="member-signature"><span class="modifiers">public static final</span>\
&nbsp;<span class="return-type"><a href="SomeEnum.html" title="enum in linksourc\
&nbsp;<span class="return-type"><a href="SomeEnum.html" title="enum class in linksourc\
e">SomeEnum</a></span>&nbsp;<span class="element-name"><a href="../src-html/linksource/S\
omeEnum.html#line.30">VALUE2</a></span></div>""");

@ -249,9 +249,9 @@ public class TestOrdering extends JavadocTester {
String expectedEnumOrdering[] = {
"""
Add.add.html" title="enum in REPLACE_ME\"""",
Add.add.html" title="enum class in REPLACE_ME\"""",
"""
Add.ADD.html" title="enum in REPLACE_ME\""""
Add.ADD.html" title="enum class in REPLACE_ME\""""
};
String expectedFieldOrdering[] = {
@ -397,78 +397,78 @@ public class TestOrdering extends JavadocTester {
checkOrder("index-all.html", composeTestVectors());
checkOrder("add0/add/package-tree.html",
"""
<a href="Add.add.html" title="enum in add0.add">""",
<a href="Add.add.html" title="enum class in add0.add">""",
"""
<a href="Add.ADD.html" title="enum in add0.add">""");
<a href="Add.ADD.html" title="enum class in add0.add">""");
checkOrder("overview-tree.html",
"""
<a href="Add.add.html" title="enum in &lt;Unnamed&gt;">""",
<a href="Add.add.html" title="enum class in &lt;Unnamed&gt;">""",
"""
<a href="add0/Add.add.html" title="enum in add0">""",
<a href="add0/Add.add.html" title="enum class in add0">""",
"""
<a href="add0/add/Add.add.html" title="enum in add0.add">""",
<a href="add0/add/Add.add.html" title="enum class in add0.add">""",
"""
<a href="add0/add/add/Add.add.html" title="enum in add0.add.add">""",
<a href="add0/add/add/Add.add.html" title="enum class in add0.add.add">""",
"""
<a href="add0/add/add/add/Add.add.html" title="enum in add0.add.add.add">""",
<a href="add0/add/add/add/Add.add.html" title="enum class in add0.add.add.add">""",
"""
<a href="add1/Add.add.html" title="enum in add1">""",
<a href="add1/Add.add.html" title="enum class in add1">""",
"""
<a href="add1/add/Add.add.html" title="enum in add1.add">""",
<a href="add1/add/Add.add.html" title="enum class in add1.add">""",
"""
<a href="add1/add/add/Add.add.html" title="enum in add1.add.add">""",
<a href="add1/add/add/Add.add.html" title="enum class in add1.add.add">""",
"""
<a href="add1/add/add/add/Add.add.html" title="enum in add1.add.add.add">""",
<a href="add1/add/add/add/Add.add.html" title="enum class in add1.add.add.add">""",
"""
<a href="add2/Add.add.html" title="enum in add2">""",
<a href="add2/Add.add.html" title="enum class in add2">""",
"""
<a href="add2/add/Add.add.html" title="enum in add2.add">""",
<a href="add2/add/Add.add.html" title="enum class in add2.add">""",
"""
<a href="add2/add/add/Add.add.html" title="enum in add2.add.add">""",
<a href="add2/add/add/Add.add.html" title="enum class in add2.add.add">""",
"""
<a href="add2/add/add/add/Add.add.html" title="enum in add2.add.add.add">""",
<a href="add2/add/add/add/Add.add.html" title="enum class in add2.add.add.add">""",
"""
<a href="add3/Add.add.html" title="enum in add3">""",
<a href="add3/Add.add.html" title="enum class in add3">""",
"""
<a href="add3/add/Add.add.html" title="enum in add3.add">""",
<a href="add3/add/Add.add.html" title="enum class in add3.add">""",
"""
<a href="add3/add/add/Add.add.html" title="enum in add3.add.add">""",
<a href="add3/add/add/Add.add.html" title="enum class in add3.add.add">""",
"""
<a href="add3/add/add/add/Add.add.html" title="enum in add3.add.add.add">""",
<a href="add3/add/add/add/Add.add.html" title="enum class in add3.add.add.add">""",
"""
<a href="Add.ADD.html" title="enum in &lt;Unnamed&gt;">""",
<a href="Add.ADD.html" title="enum class in &lt;Unnamed&gt;">""",
"""
<a href="add0/Add.ADD.html" title="enum in add0">""",
<a href="add0/Add.ADD.html" title="enum class in add0">""",
"""
<a href="add0/add/Add.ADD.html" title="enum in add0.add">""",
<a href="add0/add/Add.ADD.html" title="enum class in add0.add">""",
"""
<a href="add0/add/add/Add.ADD.html" title="enum in add0.add.add">""",
<a href="add0/add/add/Add.ADD.html" title="enum class in add0.add.add">""",
"""
<a href="add0/add/add/add/Add.ADD.html" title="enum in add0.add.add.add">""",
<a href="add0/add/add/add/Add.ADD.html" title="enum class in add0.add.add.add">""",
"""
<a href="add1/Add.ADD.html" title="enum in add1">""",
<a href="add1/Add.ADD.html" title="enum class in add1">""",
"""
<a href="add1/add/Add.ADD.html" title="enum in add1.add">""",
<a href="add1/add/Add.ADD.html" title="enum class in add1.add">""",
"""
<a href="add1/add/add/Add.ADD.html" title="enum in add1.add.add">""",
<a href="add1/add/add/Add.ADD.html" title="enum class in add1.add.add">""",
"""
<a href="add1/add/add/add/Add.ADD.html" title="enum in add1.add.add.add">""",
<a href="add1/add/add/add/Add.ADD.html" title="enum class in add1.add.add.add">""",
"""
<a href="add2/Add.ADD.html" title="enum in add2">""",
<a href="add2/Add.ADD.html" title="enum class in add2">""",
"""
<a href="add2/add/Add.ADD.html" title="enum in add2.add">""",
<a href="add2/add/Add.ADD.html" title="enum class in add2.add">""",
"""
<a href="add2/add/add/Add.ADD.html" title="enum in add2.add.add">""",
<a href="add2/add/add/Add.ADD.html" title="enum class in add2.add.add">""",
"""
<a href="add2/add/add/add/Add.ADD.html" title="enum in add2.add.add.add">""",
<a href="add2/add/add/add/Add.ADD.html" title="enum class in add2.add.add.add">""",
"""
<a href="add3/Add.ADD.html" title="enum in add3">""",
<a href="add3/Add.ADD.html" title="enum class in add3">""",
"""
<a href="add3/add/Add.ADD.html" title="enum in add3.add">""",
<a href="add3/add/Add.ADD.html" title="enum class in add3.add">""",
"""
<a href="add3/add/add/Add.ADD.html" title="enum in add3.add.add">""",
<a href="add3/add/add/Add.ADD.html" title="enum class in add3.add.add">""",
"""
<a href="add3/add/add/add/Add.ADD.html" title="enum in add3.add.add.add">""");
<a href="add3/add/add/add/Add.ADD.html" title="enum class in add3.add.add.add">""");
}
void emitFile(String pkgname, String clsname, ListOrder order) throws IOException {
@ -558,9 +558,9 @@ public class TestOrdering extends JavadocTester {
checkOrder("index-all.html",
"something</a> - package something</dt>",
"something</span></a> - Class in",
"something</span></a> - Enum in",
"something</span></a> - Enum Class in",
"something</span></a> - Interface in",
"something</span></a> - Annotation Type in",
"something</span></a> - Annotation Interface in",
"something</a></span> - Variable in class",
"something()</a></span> - Constructor",
"""

@ -304,9 +304,9 @@ public class TestOverrideMethods extends JavadocTester {
<a href="pkg5/Classes.C.html#m7()">m7()</a>""",
"""
<a href="pkg5/Classes.GP.html#m7()">m7()</a>""",
"Returns the enum constant of this type with the specified name.",
"Returns the enum constant of this class with the specified name.",
"""
Returns an array containing the constants of this enum type, in
Returns an array containing the constants of this enum class, in
the order they are declared."""
);

@ -87,7 +87,7 @@ public class TestRecordLinks extends JavadocTester {
checkOutput("example/JavadocTest.Bar.html", true,
"""
<h1 title="Record JavadocTest.Bar" class="title">Record JavadocTest.Bar</h1>
<h1 title="Record Class JavadocTest.Bar" class="title">Record Class JavadocTest.Bar</h1>
""",
"""
<div class="block"><a href="#bar()"><code>bar()</code></a>

@ -73,7 +73,7 @@ public class TestRecordTypes extends JavadocTester {
checkOutput("R.html", true,
"""
<h1 title="Record R" class="title">Record R</h1>""",
<h1 title="Record Class R" class="title">Record Class R</h1>""",
"""
<span class="modifiers">public record </span><span class="element-name type-name-label">R</span>""",
"""
@ -94,7 +94,7 @@ public class TestRecordTypes extends JavadocTester {
checkOutput("p/R.html", true,
"""
<h1 title="Record R" class="title">Record R</h1>""",
<h1 title="Record Class R" class="title">Record Class R</h1>""",
"""
<span class="modifiers">public record </span><span class="element-name type-name-label">R</span>""",
"""
@ -115,7 +115,7 @@ public class TestRecordTypes extends JavadocTester {
checkOutput("p/R.html", true,
"""
<h1 title="Record R" class="title">Record R</h1>""",
<h1 title="Record Class R" class="title">Record Class R</h1>""",
"""
<span class="modifiers">public record </span><span class="element-name type-name-label">R</span>""",
"""
@ -140,7 +140,7 @@ public class TestRecordTypes extends JavadocTester {
checkOutput("p/R.html", true,
"""
<h1 title="Record R" class="title">Record R</h1>""",
<h1 title="Record Class R" class="title">Record Class R</h1>""",
"""
<span class="modifiers">public record </span><span class="element-name type-name-label">R</span>""",
"""
@ -171,7 +171,7 @@ public class TestRecordTypes extends JavadocTester {
checkOutput("p/R.html", true,
"""
<h1 title="Record R" class="title">Record R&lt;T&gt;</h1>""",
<h1 title="Record Class R" class="title">Record Class R&lt;T&gt;</h1>""",
"""
<span class="modifiers">public record </span><span class="element-name type-name-label">R&lt;T&gt;</span>""",
"""
@ -208,7 +208,7 @@ public class TestRecordTypes extends JavadocTester {
"""
<section class="constructor-summary" id="constructor.summary">""",
"<a href=\"#%3Cinit%3E(int)\">R</a>",
"Creates an instance of a <code>R</code> record.",
"Creates an instance of a <code>R</code> record class.",
"""
<section class="method-summary" id="method.summary">""",
"""
@ -223,12 +223,12 @@ public class TestRecordTypes extends JavadocTester {
Returns the value of the <a href="#param-r1"><code>r1</code></a> record component.""",
"""
<a href="#toString()">toString</a>""",
"Returns a string representation of this record.",
"Returns a string representation of this record class.",
"Method Details",
"""
<span class="element-name">toString</span>""",
"Returns a string representation of this record. The representation "
+ "contains the name of the type, followed by the name and value of "
"Returns a string representation of this record class. The representation "
+ "contains the name of the class, followed by the name and value of "
+ "each of the record components.",
"""
<span class="element-name">hashCode</span>""",
@ -239,7 +239,7 @@ public class TestRecordTypes extends JavadocTester {
"""
Indicates whether some other object is "equal to" this one. The objects are equa\
l if the other object is of the same class and if all the record components are \
equal. All components in this record are compared with '=='.""",
equal. All components in this record class are compared with '=='.""",
"""
<span class="element-name">r1</span>""",
"""
@ -271,7 +271,7 @@ public class TestRecordTypes extends JavadocTester {
"""
<section class="constructor-summary" id="constructor.summary">""",
"<a href=\"#%3Cinit%3E(int)\">R</a>",
"Creates an instance of a <code>R</code> record.",
"Creates an instance of a <code>R</code> record class.",
"""
<section class="method-summary" id="method.summary">""",
"""
@ -286,12 +286,12 @@ public class TestRecordTypes extends JavadocTester {
Returns the value of the <a href="#param-r1"><code>r1</code></a> record component.""",
"""
<a href="#toString()">toString</a>""",
"Returns a string representation of this record.",
"Returns a string representation of this record class.",
"Method Details",
"""
<span class="element-name">toString</span>""",
"Returns a string representation of this record. The representation "
+ "contains the name of the type, followed by the name and value of "
"Returns a string representation of this record class. The representation "
+ "contains the name of the class, followed by the name and value of "
+ "each of the record components.",
"""
<span class="element-name">hashCode</span>""",
@ -302,7 +302,7 @@ public class TestRecordTypes extends JavadocTester {
"""
Indicates whether some other object is "equal to" this one. The objects are equa\
l if the other object is of the same class and if all the record components are \
equal. All components in this record are compared with '=='.""",
equal. All components in this record class are compared with '=='.""",
"""
<span class="element-name">r1</span>""",
"""
@ -313,13 +313,13 @@ public class TestRecordTypes extends JavadocTester {
@Test
public void testGeneratedEqualsPrimitive(Path base) throws IOException {
testGeneratedEquals(base, "int a, int b",
"All components in this record are compared with '=='.");
"All components in this record class are compared with '=='.");
}
@Test
public void testGeneratedEqualsReference(Path base) throws IOException {
testGeneratedEquals(base, "Object a, Object b",
"All components in this record are compared with <code>Objects::equals(Object,Object)</code>");
"All components in this record class are compared with <code>Objects::equals(Object,Object)</code>");
}
@Test
@ -522,7 +522,7 @@ public class TestRecordTypes extends JavadocTester {
<div id="record.class">
<div class="caption"><span>Record Classes</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Record</div>
<div class="table-header col-first">Record Class</div>
<div class="table-header col-last">Description</div>
<div class="col-deprecated-item-name even-row-color"><a href="p/R.html" title="class in p">p.R</a></div>
<div class="col-last even-row-color">

@ -452,7 +452,7 @@ public class TestSearch extends JavadocTester {
"""
<dt><span class="search-tag-link"><a href="pkg2/TestAnnotationType.html#searchph\
rasewithdescdeprecated">search phrase with desc deprecated</a></span> - Search t\
ag in annotation type pkg2.TestAnnotationType</dt>""",
ag in annotation interface pkg2.TestAnnotationType</dt>""",
"""
<dt><span class="search-tag-link"><a href="pkg2/TestClass.html#SearchTagDeprecat\
edClass">SearchTagDeprecatedClass</a></span> - Search tag in class pkg2.TestClas\
@ -487,14 +487,14 @@ public class TestSearch extends JavadocTester {
/a></span> - Search tag in pkg.AnotherClass.CONSTANT1</dt>""",
"""
<dt><span class="member-name-link"><a href="pkg2/TestEnum.html#ONE">ONE</a></spa\
n> - Enum constant in enum pkg2.<a href="pkg2/TestEnum.html" title="enum in pkg2">TestEnum</a></dt>""",
n> - Enum constant in enum class pkg2.<a href="pkg2/TestEnum.html" title="enum class in pkg2">TestEnum</a></dt>""",
"""
<dt><span class="member-name-link"><a href="pkg2/TestEnum.html#THREE">THREE</a><\
/span> - Enum constant in enum pkg2.<a href="pkg2/TestEnum.html" title="enum in pkg2">TestEnum</a></dt\
/span> - Enum constant in enum class pkg2.<a href="pkg2/TestEnum.html" title="enum class in pkg2">TestEnum</a></dt\
>""",
"""
<dt><span class="member-name-link"><a href="pkg2/TestEnum.html#TWO">TWO</a></spa\
n> - Enum constant in enum pkg2.<a href="pkg2/TestEnum.html" title="enum in pkg2">TestEnum</a></dt>""");
n> - Enum constant in enum class pkg2.<a href="pkg2/TestEnum.html" title="enum class in pkg2">TestEnum</a></dt>""");
checkOutput("index-all.html", true,
"""
<div class="deprecation-comment">class_test1 passes. Search tag <span id="Search\
@ -518,7 +518,7 @@ public class TestSearch extends JavadocTester {
"""
<dt><span class="search-tag-link"><a href="../pkg2/TestAnnotationType.html#searc\
hphrasewithdescdeprecated">search phrase with desc deprecated</a></span> - Searc\
h tag in annotation type pkg2.TestAnnotationType</dt>""",
h tag in annotation interface pkg2.TestAnnotationType</dt>""",
"""
<dt><span class="search-tag-link"><a href="../pkg2/TestClass.html#SearchTagDepre\
catedClass">SearchTagDeprecatedClass</a></span> - Search tag in class pkg2.TestC\
@ -575,16 +575,16 @@ public class TestSearch extends JavadocTester {
checkOutput("index-files/index-9.html", true,
"""
<dt><span class="member-name-link"><a href="../pkg2/TestEnum.html#ONE">ONE</a></\
span> - Enum constant in enum pkg2.<a href="../pkg2/TestEnum.html" title="enum in pkg2">TestEnum</a></\
span> - Enum constant in enum class pkg2.<a href="../pkg2/TestEnum.html" title="enum class in pkg2">TestEnum</a></\
dt>""");
checkOutput("index-files/index-14.html", true,
"""
<dt><span class="member-name-link"><a href="../pkg2/TestEnum.html#THREE">THREE</\
a></span> - Enum constant in enum pkg2.<a href="../pkg2/TestEnum.html" title="enum in pkg2">TestEnum</\
a></span> - Enum constant in enum class pkg2.<a href="../pkg2/TestEnum.html" title="enum class in pkg2">TestEnum</\
a></dt>""",
"""
<dt><span class="member-name-link"><a href="../pkg2/TestEnum.html#TWO">TWO</a></\
span> - Enum constant in enum pkg2.<a href="../pkg2/TestEnum.html" title="enum in pkg2">TestEnum</a></\
span> - Enum constant in enum class pkg2.<a href="../pkg2/TestEnum.html" title="enum class in pkg2">TestEnum</a></\
dt>""");
}
@ -611,7 +611,7 @@ public class TestSearch extends JavadocTester {
"""
<dt><span class="search-tag-link"><a href="pkg2/TestAnnotationType.html#searchph\
rasewithdescdeprecated">search phrase with desc deprecated</a></span> - Search t\
ag in annotation type pkg2.TestAnnotationType</dt>""",
ag in annotation interface pkg2.TestAnnotationType</dt>""",
"""
<dt><span class="search-tag-link"><a href="pkg2/TestClass.html#SearchTagDeprecat\
edClass">SearchTagDeprecatedClass</a></span> - Search tag in class pkg2.TestClas\
@ -655,7 +655,7 @@ public class TestSearch extends JavadocTester {
"""
<dt><span class="search-tag-link"><a href="pkg2/TestAnnotationType.html#searchph\
rasewithdescdeprecated">search phrase with desc deprecated</a></span> - Search t\
ag in annotation type pkg2.TestAnnotationType</dt>""",
ag in annotation interface pkg2.TestAnnotationType</dt>""",
"""
<dt><span class="search-tag-link"><a href="pkg2/TestClass.html#SearchTagDeprecat\
edClass">SearchTagDeprecatedClass</a></span> - Search tag in class pkg2.TestClas\
@ -833,7 +833,7 @@ public class TestSearch extends JavadocTester {
<button id="all-classes-table-tab3" role="tab" aria-selected="false" aria-contro\
ls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" oncli\
ck="show('all-classes-table', 'all-classes-table-tab3', 2)" class="table-tab">En\
um Summary</button>\
um Class Summary</button>\
<button id="all-classes-table-tab4" role="tab" aria-selected="false" aria-contro\
ls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" oncli\
ck="show('all-classes-table', 'all-classes-table-tab4', 2)" class="table-tab">Ex\
@ -845,7 +845,7 @@ public class TestSearch extends JavadocTester {
<button id="all-classes-table-tab6" role="tab" aria-selected="false" aria-contro\
ls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" oncli\
ck="show('all-classes-table', 'all-classes-table-tab6', 2)" class="table-tab">An\
notation Types Summary</button>\
notation Interfaces Summary</button>\
</div>
<div id="all-classes-table.tabpanel" role="tabpanel">
<div class="summary-table two-column-summary" aria-labelledby="all-classes-table-tab0">

@ -63,7 +63,7 @@ public class TestSystemPropertyTaglet extends JavadocTester {
checkOrder("mymodule/mypackage/MyAnnotation.html",
"""
<h1 title="Annotation Type MyAnnotation" class="title">Annotation Type MyAnnotation</h1>""",
<h1 title="Annotation Interface MyAnnotation" class="title">Annotation Interface MyAnnotation</h1>""",
"""
(annotation) the <code><span id="test.property" class="search-tag-result">test.property</span></code> system property.""",
"<h2>Element Details</h2>",
@ -99,7 +99,7 @@ public class TestSystemPropertyTaglet extends JavadocTester {
checkOrder("mymodule/mypackage/MyEnum.html",
"""
<h1 title="Enum MyEnum" class="title">Enum MyEnum</h1>""",
<h1 title="Enum Class MyEnum" class="title">Enum Class MyEnum</h1>""",
"""
(enum) the <code><span id="test.property" class="search-tag-result">test.property</span></code> system property.""",
"<h2>Enum Constant Details</h2>",
@ -166,7 +166,7 @@ public class TestSystemPropertyTaglet extends JavadocTester {
<h2 class="title" id="I:T">T</h2>""",
"""
<dt><span class="search-tag-link"><a href="mymodule/mypackage/MyAnnotation.html#\
test.property">test.property</a></span> - Search tag in annotation type mypackag\
test.property">test.property</a></span> - Search tag in annotation interface mypackag\
e.MyAnnotation</dt>
<dd>System Property</dd>""",
"""
@ -175,7 +175,7 @@ public class TestSystemPropertyTaglet extends JavadocTester {
<dd>System Property</dd>""",
"""
<dt><span class="search-tag-link"><a href="mymodule/mypackage/MyEnum.html#test.p\
roperty">test.property</a></span> - Search tag in enum mypackage.MyEnum</dt>
roperty">test.property</a></span> - Search tag in enum class mypackage.MyEnum</dt>
<dd>System Property</dd>""",
"""
<dt><span class="search-tag-link"><a href="mymodule/mypackage/MyError.html#test.\
@ -267,13 +267,13 @@ public class TestSystemPropertyTaglet extends JavadocTester {
checkOutput("tag-search-index.js", true,
"""
{"l":"test.property","h":"annotation type mypackage.MyAnnotation","d":"System Pr\
{"l":"test.property","h":"annotation interface mypackage.MyAnnotation","d":"System Pr\
operty","u":"mymodule/mypackage/MyAnnotation.html#test.property"}""",
"""
{"l":"test.property","h":"class mypackage.MyClass","d":"System Property","u":"my\
module/mypackage/MyClass.html#test.property"}""",
"""
{"l":"test.property","h":"enum mypackage.MyEnum","d":"System Property","u":"mymo\
{"l":"test.property","h":"enum class mypackage.MyEnum","d":"System Property","u":"mymo\
dule/mypackage/MyEnum.html#test.property"}""",
"""
{"l":"test.property","h":"error mypackage.MyError","d":"System Property","u":"my\

@ -0,0 +1,157 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8258002
* @summary Update "type" terminology in generated docs
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build toolbox.ToolBox javadoc.tester.*
* @run main TestTerminology
*/
import java.io.IOException;
import java.nio.file.Path;
import javax.lang.model.SourceVersion;
import javadoc.tester.JavadocTester;
import toolbox.ToolBox;
public class TestTerminology extends JavadocTester {
public static void main(String... args) throws Exception {
TestTerminology tester = new TestTerminology();
tester.runTests(m -> new Object[]{Path.of(m.getName())});
}
private final ToolBox tb = new ToolBox();
@Test
public void testAnnotationInterface(Path base) throws IOException {
Path src = base.resolve("src");
tb.writeJavaFiles(src,
"""
package p; /** Comment. */ public @interface A {
int m();
}
"""
);
testAnnotationInterface(base, src, SourceVersion.RELEASE_15);
testAnnotationInterface(base, src, SourceVersion.latest());
}
void testAnnotationInterface(Path base, Path src, SourceVersion sv) {
String v = asOption(sv);
javadoc("-d", base.resolve("out" + v).toString(),
"--source-path", src.toString(),
"--source", v,
"-use",
"p");
checkExit(Exit.OK);
checkOutput("p/A.html", sv.compareTo(SourceVersion.RELEASE_16) < 0,
"""
<h1 title="Annotation Type A" class="title">Annotation Type A</h1>"""
);
checkOutput("p/A.html", sv.compareTo(SourceVersion.RELEASE_16) >= 0,
"""
<h1 title="Annotation Interface A" class="title">Annotation Interface A</h1>"""
);
checkOutput("p/class-use/A.html", sv.compareTo(SourceVersion.RELEASE_16) < 0,
"""
<h1 title="Uses of Annotation Type p.A" class="title">Uses of Annotation Type<br>p.A</h1>"""
);
checkOutput("p/class-use/A.html", sv.compareTo(SourceVersion.RELEASE_16) >= 0,
"""
<h1 title="Uses of Annotation Interface p.A" class="title">Uses of Annotation Interface<br>p.A</h1>"""
);
}
@Test
public void testEnumClass(Path base) throws IOException {
Path src = base.resolve("src");
tb.writeJavaFiles(src,
"""
package p; /** Comment. */ public enum E { }
"""
);
testEnumClass(base, src, SourceVersion.RELEASE_15);
testEnumClass(base, src, SourceVersion.latest());
}
void testEnumClass(Path base, Path src, SourceVersion sv) {
String v = asOption(sv);
javadoc("-d", base.resolve("out" + v).toString(),
"--source-path", src.toString(),
"--source", v,
"p");
checkExit(Exit.OK);
checkOutput("p/E.html", sv.compareTo(SourceVersion.RELEASE_16) < 0,
"""
<h1 title="Enum E" class="title">Enum E</h1>"""
);
checkOutput("p/E.html", sv.compareTo(SourceVersion.RELEASE_16) >= 0,
"""
<h1 title="Enum Class E" class="title">Enum Class E</h1>"""
);
}
@Test
public void testSearch(Path base) throws IOException {
Path src = base.resolve("src");
tb.writeJavaFiles(src,
"""
package p; /** Comment. */ public class C { }
"""
);
testSearch(base, src, SourceVersion.RELEASE_15);
testSearch(base, src, SourceVersion.latest());
}
public void testSearch(Path base, Path src, SourceVersion sv) {
String v = asOption(sv);
javadoc("-d", base.resolve("out" + v).toString(),
"--source-path", src.toString(),
"--source", v,
"p");
checkExit(Exit.OK);
checkOutput("search.js", sv.compareTo(SourceVersion.RELEASE_16) < 0,
"""
var catTypes = "Types";""" //
);
checkOutput("search.js", sv.compareTo(SourceVersion.RELEASE_16) >= 0,
"""
var catTypes = "Classes and Interfaces";"""
);
}
private String asOption(SourceVersion sv) {
return sv.name().replace("RELEASE_", "");
}
}

@ -216,7 +216,7 @@ public class CheckResourceKeys {
// special handling for code strings synthesized in
// jdk.javadoc.internal.doclets.toolkit.util.Utils.getTypeName
String[] extras = {
"AnnotationType", "Class", "Enum", "Error", "Exception", "Interface", "Record"
"AnnotationType", "Class", "Enum", "EnumClass", "Error", "Exception", "Interface", "RecordClass"
};
for (String s: extras) {
if (results.contains("doclet." + s))