Skip to content

Commit 8fc201e

Browse files
committedMay 31, 2022
8285939: javadoc java.lang.Record should not have "Direct Known Subclasses:" section
Reviewed-by: prappo, hannesw
1 parent f5bbade commit 8fc201e

File tree

11 files changed

+316
-296
lines changed

11 files changed

+316
-296
lines changed
 

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java

+25-32
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@
2525

2626
package jdk.javadoc.internal.doclets.formats.html;
2727

28-
import java.util.*;
29-
30-
import javax.lang.model.element.TypeElement;
31-
3228
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
33-
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
3429
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
30+
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
3531
import jdk.javadoc.internal.doclets.toolkit.Content;
3632
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
33+
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree.Hierarchy;
3734
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
3835

36+
import javax.lang.model.element.TypeElement;
37+
import java.util.Collection;
38+
import java.util.SortedSet;
39+
import java.util.TreeSet;
40+
3941

4042
/**
4143
* Abstract class to print the class hierarchy page for all the Classes. This
@@ -48,20 +50,19 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
4850
/**
4951
* The class and interface tree built by using {@link ClassTree}
5052
*/
51-
protected final ClassTree classtree;
53+
protected final ClassTree classTree;
5254

5355
/**
54-
* Constructor initializes classtree variable. This constructor will be used
55-
* while generating global tree file "overview-tree.html".
56+
* Constructor. This constructor will be used while generating global tree file "overview-tree.html".
5657
*
5758
* @param configuration The current configuration
5859
* @param filename File to be generated.
59-
* @param classtree Tree built by {@link ClassTree}.
60+
* @param classTree Tree built by {@link ClassTree}.
6061
*/
6162
protected AbstractTreeWriter(HtmlConfiguration configuration,
62-
DocPath filename, ClassTree classtree) {
63+
DocPath filename, ClassTree classTree) {
6364
super(configuration, filename);
64-
this.classtree = classtree;
65+
this.classTree = classTree;
6566
}
6667

6768
/**
@@ -71,56 +72,48 @@ protected AbstractTreeWriter(HtmlConfiguration configuration,
7172
*
7273
* @param parent the superclass or superinterface of the sset
7374
* @param collection a collection of the sub-classes at this level
74-
* @param isEnum true if we are generating a tree for enums
75+
* @param hierarchy the hierarchy for which we are generating a tree
7576
* @param content the content to which the level information will be added
7677
*/
7778
protected void addLevelInfo(TypeElement parent, Collection<TypeElement> collection,
78-
boolean isEnum, Content content) {
79+
Hierarchy hierarchy, Content content) {
7980
if (!collection.isEmpty()) {
8081
var ul = new HtmlTree(TagName.UL);
8182
for (TypeElement local : collection) {
8283
var li = new HtmlTree(TagName.LI);
8384
li.setStyle(HtmlStyle.circle);
8485
addPartialInfo(local, li);
8586
addExtendsImplements(parent, local, li);
86-
addLevelInfo(local, classtree.directSubClasses(local, isEnum),
87-
isEnum, li); // Recurse
87+
addLevelInfo(local, hierarchy.subtypes(local), hierarchy, li); // Recurse
8888
ul.add(li);
8989
}
9090
content.add(ul);
9191
}
9292
}
9393

9494
/**
95-
* Add the heading for the tree depending upon tree type if it's a
96-
* Class Tree or Interface tree.
95+
* Adds a class or interface hierarchy with a given heading to given content.
9796
*
98-
* @param sset classes which are at the most base level, all the
99-
* other classes in this run will derive from these classes
100-
* @param heading heading for the tree
101-
* @param content the content to which the tree will be added
97+
* @param hierarchy the hierarchy to add
98+
* @param heading the heading
99+
* @param content the content to which to add the hierarchy
102100
*/
103-
protected void addTree(SortedSet<TypeElement> sset, String heading, Content content) {
104-
addTree(sset, heading, content, false);
105-
}
106-
107-
protected void addTree(SortedSet<TypeElement> sset, String heading,
108-
Content content, boolean isEnums) {
109-
if (!sset.isEmpty()) {
110-
TypeElement firstTypeElement = sset.first();
101+
protected void addTree(Hierarchy hierarchy, String heading, Content content) {
102+
SortedSet<TypeElement> roots = hierarchy.roots();
103+
if (!roots.isEmpty()) {
104+
TypeElement firstTypeElement = roots.first();
111105
Content headingContent = contents.getContent(heading);
112106
var sectionHeading = HtmlTree.HEADING_TITLE(Headings.CONTENT_HEADING,
113107
headingContent);
114108
var section = HtmlTree.SECTION(HtmlStyle.hierarchy, sectionHeading);
115109
addLevelInfo(!utils.isPlainInterface(firstTypeElement) ? firstTypeElement : null,
116-
sset, isEnums, section);
110+
roots, hierarchy, section);
117111
content.add(section);
118112
}
119113
}
120114

121115
/**
122-
* Add information regarding the classes which this class extends or
123-
* implements.
116+
* Add information regarding the classes which this class extends or implements.
124117
*
125118
* @param parent the parent class of the class being documented
126119
* @param typeElement the TypeElement under consideration

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ public ClassUseWriter(HtmlConfiguration configuration,
143143
* Write out class use pages.
144144
*
145145
* @param configuration the configuration for this doclet
146-
* @param classtree the class tree hierarchy
146+
* @param classTree the class tree hierarchy
147147
* @throws DocFileIOException if there is an error while generating the documentation
148148
*/
149-
public static void generate(HtmlConfiguration configuration, ClassTree classtree) throws DocFileIOException {
150-
ClassUseMapper mapper = new ClassUseMapper(configuration, classtree);
149+
public static void generate(HtmlConfiguration configuration, ClassTree classTree) throws DocFileIOException {
150+
ClassUseMapper mapper = new ClassUseMapper(configuration, classTree);
151151
boolean nodeprecated = configuration.getOptions().noDeprecated();
152152
Utils utils = configuration.utils;
153153
for (TypeElement aClass : configuration.getIncludedTypeElements()) {

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
7777

7878
protected final TypeElement typeElement;
7979

80-
protected final ClassTree classtree;
80+
protected final ClassTree classTree;
8181

8282
/**
8383
* @param configuration the configuration data for the doclet
@@ -89,7 +89,7 @@ public ClassWriterImpl(HtmlConfiguration configuration, TypeElement typeElement,
8989
super(configuration, configuration.docPaths.forClass(typeElement));
9090
this.typeElement = typeElement;
9191
configuration.currentTypeElement = typeElement;
92-
this.classtree = classTree;
92+
this.classTree = classTree;
9393
}
9494

9595
@Override
@@ -285,7 +285,7 @@ public void addSubClassInfo(Content target) {
285285
return; // Don't generate the list, too huge
286286
}
287287
}
288-
Set<TypeElement> subclasses = classtree.directSubClasses(typeElement, false);
288+
Set<TypeElement> subclasses = classTree.hierarchy(typeElement).subtypes(typeElement);
289289
if (!subclasses.isEmpty()) {
290290
var dl = HtmlTree.DL(HtmlStyle.notes);
291291
dl.add(HtmlTree.DT(contents.subclassesLabel));
@@ -298,7 +298,7 @@ public void addSubClassInfo(Content target) {
298298
@Override
299299
public void addSubInterfacesInfo(Content target) {
300300
if (utils.isPlainInterface(typeElement)) {
301-
Set<TypeElement> subInterfaces = classtree.allSubClasses(typeElement, false);
301+
Set<TypeElement> subInterfaces = classTree.hierarchy(typeElement).allSubtypes(typeElement);
302302
if (!subInterfaces.isEmpty()) {
303303
var dl = HtmlTree.DL(HtmlStyle.notes);
304304
dl.add(HtmlTree.DT(contents.subinterfacesLabel));
@@ -318,7 +318,7 @@ public void addInterfaceUsageInfo(Content target) {
318318
return; // Don't generate the list, too huge
319319
}
320320
}
321-
Set<TypeElement> implcl = classtree.implementingClasses(typeElement);
321+
Set<TypeElement> implcl = classTree.implementingClasses(typeElement);
322322
if (!implcl.isEmpty()) {
323323
var dl = HtmlTree.DL(HtmlStyle.notes);
324324
dl.add(HtmlTree.DT(contents.implementingClassesLabel));

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ public void generateClassFiles(ClassTree classTree) throws DocletException {
203203
* @throws DocletException if there is a problem while writing the other files
204204
*/
205205
@Override // defined by AbstractDoclet
206-
protected void generateOtherFiles(ClassTree classtree)
206+
protected void generateOtherFiles(ClassTree classTree)
207207
throws DocletException {
208-
super.generateOtherFiles(classtree);
208+
super.generateOtherFiles(classTree);
209209
HtmlOptions options = configuration.getOptions();
210210
if (options.linkSource()) {
211211
SourceToHTMLConverter.convertRoot(configuration, DocPaths.SOURCE_OUTPUT);
@@ -228,11 +228,11 @@ protected void generateOtherFiles(ClassTree classtree)
228228
}
229229
// do early to reduce memory footprint
230230
if (options.classUse()) {
231-
ClassUseWriter.generate(configuration, classtree);
231+
ClassUseWriter.generate(configuration, classTree);
232232
}
233233

234234
if (options.createTree()) {
235-
TreeWriter.generate(configuration, classtree);
235+
TreeWriter.generate(configuration, classTree);
236236
}
237237

238238
if (configuration.conditionalPages.contains((HtmlConfiguration.ConditionalPage.DEPRECATED))) {
@@ -392,7 +392,7 @@ protected void generateModuleFiles() throws DocletException {
392392
}
393393

394394
@Override // defined by AbstractDoclet
395-
protected void generatePackageFiles(ClassTree classtree) throws DocletException {
395+
protected void generatePackageFiles(ClassTree classTree) throws DocletException {
396396
HtmlOptions options = configuration.getOptions();
397397
Set<PackageElement> packages = configuration.packages;
398398
List<PackageElement> pList = new ArrayList<>(packages);

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents;
3232
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
3333
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
34-
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
3534
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
3635
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
3736
import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -103,10 +102,11 @@ protected void generatePackageTreeFile() throws DocFileIOException {
103102
addLinkToAllPackages(div);
104103
}
105104
mainContent.add(div);
106-
addTree(classtree.baseClasses(), "doclet.Class_Hierarchy", mainContent);
107-
addTree(classtree.baseInterfaces(), "doclet.Interface_Hierarchy", mainContent);
108-
addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", mainContent);
109-
addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", mainContent, true);
105+
addTree(classTree.classes(), "doclet.Class_Hierarchy", mainContent);
106+
addTree(classTree.interfaces(), "doclet.Interface_Hierarchy", mainContent);
107+
addTree(classTree.annotationInterfaces(), "doclet.Annotation_Type_Hierarchy", mainContent);
108+
addTree(classTree.enumClasses(), "doclet.Enum_Hierarchy", mainContent);
109+
addTree(classTree.recordClasses(), "doclet.Record_Class_Hierarchy", mainContent);
110110
bodyContents.addMainContent(mainContent);
111111
bodyContents.setFooter(getFooter());
112112
body.add(bodyContents);

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java

+11-10
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ public class TreeWriter extends AbstractTreeWriter {
6666
*
6767
* @param configuration the current configuration of the doclet.
6868
* @param filename String filename
69-
* @param classtree the tree being built.
69+
* @param classTree the tree being built.
7070
*/
71-
public TreeWriter(HtmlConfiguration configuration, DocPath filename, ClassTree classtree) {
72-
super(configuration, filename, classtree);
71+
public TreeWriter(HtmlConfiguration configuration, DocPath filename, ClassTree classTree) {
72+
super(configuration, filename, classTree);
7373
packages = configuration.packages;
7474
classesOnly = packages.isEmpty();
7575
this.bodyContents = new BodyContents();
@@ -80,13 +80,13 @@ public TreeWriter(HtmlConfiguration configuration, DocPath filename, ClassTree c
8080
* "overview-tree.html" file.
8181
*
8282
* @param configuration the configuration for this doclet
83-
* @param classtree the class tree being documented.
83+
* @param classTree the class tree being documented.
8484
* @throws DocFileIOException if there is a problem generating the overview tree page
8585
*/
8686
public static void generate(HtmlConfiguration configuration,
87-
ClassTree classtree) throws DocFileIOException {
87+
ClassTree classTree) throws DocFileIOException {
8888
DocPath filename = DocPaths.OVERVIEW_TREE;
89-
TreeWriter treegen = new TreeWriter(configuration, filename, classtree);
89+
TreeWriter treegen = new TreeWriter(configuration, filename, classTree);
9090
treegen.generateTreeFile();
9191
}
9292

@@ -104,10 +104,11 @@ public void generateTreeFile() throws DocFileIOException {
104104
addPackageTreeLinks(div);
105105
Content mainContent = new ContentBuilder();
106106
mainContent.add(div);
107-
addTree(classtree.baseClasses(), "doclet.Class_Hierarchy", mainContent);
108-
addTree(classtree.baseInterfaces(), "doclet.Interface_Hierarchy", mainContent);
109-
addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", mainContent);
110-
addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", mainContent, true);
107+
addTree(classTree.classes(), "doclet.Class_Hierarchy", mainContent);
108+
addTree(classTree.interfaces(), "doclet.Interface_Hierarchy", mainContent);
109+
addTree(classTree.annotationInterfaces(), "doclet.Annotation_Type_Hierarchy", mainContent);
110+
addTree(classTree.enumClasses(), "doclet.Enum_Hierarchy", mainContent);
111+
addTree(classTree.recordClasses(), "doclet.Record_Class_Hierarchy", mainContent);
111112
body.add(bodyContents
112113
.addMainContent(mainContent)
113114
.setFooter(getFooter()));

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ doclet.Window_Class_Hierarchy=Class Hierarchy
4141
doclet.Interface_Hierarchy=Interface Hierarchy
4242
doclet.Enum_Hierarchy=Enum Hierarchy
4343
doclet.Enum_Class_Hierarchy=Enum Class Hierarchy
44+
doclet.Record_Class_Hierarchy=Record Class Hierarchy
4445
doclet.Annotation_Type_Hierarchy=Annotation Type Hierarchy
4546
doclet.Annotation_Interface_Hierarchy=Annotation Interface Hierarchy
4647
doclet.Href_Class_Title=class in {0}

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -202,25 +202,25 @@ private void startGeneration() throws DocletException {
202202
}
203203
messages.notice("doclet.build_version",
204204
configuration.getDocletVersion());
205-
ClassTree classtree = new ClassTree(configuration, configuration.getOptions().noDeprecated());
205+
ClassTree classTree = new ClassTree(configuration);
206206

207-
generateClassFiles(classtree);
207+
generateClassFiles(classTree);
208208

209209
ElementListWriter.generate(configuration);
210-
generatePackageFiles(classtree);
210+
generatePackageFiles(classTree);
211211
generateModuleFiles();
212212

213-
generateOtherFiles(classtree);
213+
generateOtherFiles(classTree);
214214
configuration.tagletManager.printReport();
215215
}
216216

217217
/**
218218
* Generate additional documentation that is added to the API documentation.
219219
*
220-
* @param classtree the data structure representing the class tree
220+
* @param classTree the data structure representing the class tree
221221
* @throws DocletException if there is a problem while generating the documentation
222222
*/
223-
protected void generateOtherFiles(ClassTree classtree) throws DocletException {
223+
protected void generateOtherFiles(ClassTree classTree) throws DocletException {
224224
BuilderFactory builderFactory = configuration.getBuilderFactory();
225225
AbstractBuilder constantsSummaryBuilder = builderFactory.getConstantsSummaryBuilder();
226226
constantsSummaryBuilder.build();
@@ -239,28 +239,28 @@ protected void generateOtherFiles(ClassTree classtree) throws DocletException {
239239
/**
240240
* Generate the package documentation.
241241
*
242-
* @param classtree the data structure representing the class tree
242+
* @param classTree the data structure representing the class tree
243243
* @throws DocletException if there is a problem while generating the documentation
244244
*/
245-
protected abstract void generatePackageFiles(ClassTree classtree) throws DocletException;
245+
protected abstract void generatePackageFiles(ClassTree classTree) throws DocletException;
246246

247247
/**
248248
* Generate the class documentation.
249249
*
250250
* @param arr the set of types to be documented
251-
* @param classtree the data structure representing the class tree
251+
* @param classTree the data structure representing the class tree
252252
* @throws DocletException if there is a problem while generating the documentation
253253
*/
254-
protected abstract void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree)
254+
protected abstract void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classTree)
255255
throws DocletException;
256256

257257
/**
258258
* Iterate through all classes and construct documentation for them.
259259
*
260-
* @param classtree the data structure representing the class tree
260+
* @param classTree the data structure representing the class tree
261261
* @throws DocletException if there is a problem while generating the documentation
262262
*/
263-
protected void generateClassFiles(ClassTree classtree)
263+
protected void generateClassFiles(ClassTree classTree)
264264
throws DocletException {
265265

266266
SortedSet<TypeElement> classes = new TreeSet<>(utils.comparators.makeGeneralPurposeComparator());
@@ -278,6 +278,6 @@ protected void generateClassFiles(ClassTree classtree)
278278
classes.addAll(utils.getAllClasses(pkg));
279279
}
280280

281-
generateClassFiles(classes, classtree);
281+
generateClassFiles(classes, classTree);
282282
}
283283
}

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java

+200-212
Large diffs are not rendered by default.

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,7 @@
6060
*/
6161
public class ClassUseMapper {
6262

63-
private final ClassTree classtree;
63+
private final ClassTree classTree;
6464

6565
/**
6666
* Mapping of TypeElements to set of PackageElements used by that class.
@@ -192,19 +192,19 @@ public class ClassUseMapper {
192192
private final Utils utils;
193193
private final Comparators comparators;
194194

195-
public ClassUseMapper(BaseConfiguration configuration, ClassTree classtree) {
195+
public ClassUseMapper(BaseConfiguration configuration, ClassTree classTree) {
196196
docEnv = configuration.docEnv;
197197
elementUtils = docEnv.getElementUtils();
198198
typeUtils = docEnv.getTypeUtils();
199199
utils = configuration.utils;
200200
comparators = utils.comparators;
201-
this.classtree = classtree;
201+
this.classTree = classTree;
202202
classToPackage = new TreeMap<>(comparators.makeClassUseComparator());
203203
// Map subclassing, subinterfacing implementing, ...
204-
for (TypeElement te : classtree.baseClasses()) {
204+
for (TypeElement te : classTree.classes().roots()) {
205205
subclasses(te);
206206
}
207-
for (TypeElement intfc : classtree.baseInterfaces()) {
207+
for (TypeElement intfc : classTree.interfaces().roots()) {
208208
// does subinterfacing as a side-effect
209209
implementingClasses(intfc);
210210
}
@@ -286,7 +286,7 @@ private Collection<TypeElement> subclasses(TypeElement te) {
286286
Collection<TypeElement> ret = classToSubclass.get(te);
287287
if (ret == null) {
288288
ret = new TreeSet<>(comparators.makeClassUseComparator());
289-
Set<TypeElement> subs = classtree.subClasses(te);
289+
Set<TypeElement> subs = classTree.subClasses(te);
290290
if (subs != null) {
291291
ret.addAll(subs);
292292
for (TypeElement sub : subs) {
@@ -305,7 +305,7 @@ private Collection<TypeElement> subinterfaces(TypeElement te) {
305305
Collection<TypeElement> ret = classToSubinterface.get(te);
306306
if (ret == null) {
307307
ret = new TreeSet<>(comparators.makeClassUseComparator());
308-
Set<TypeElement> subs = classtree.subInterfaces(te);
308+
Set<TypeElement> subs = classTree.subInterfaces(te);
309309
if (subs != null) {
310310
ret.addAll(subs);
311311
for (TypeElement sub : subs) {
@@ -326,7 +326,7 @@ private Collection<TypeElement> implementingClasses(TypeElement te) {
326326
Collection<TypeElement> ret = classToImplementingClass.get(te);
327327
if (ret == null) {
328328
ret = new TreeSet<>(comparators.makeClassUseComparator());
329-
Set<TypeElement> impl = classtree.implementingClasses(te);
329+
Set<TypeElement> impl = classTree.implementingClasses(te);
330330
if (impl != null) {
331331
ret.addAll(impl);
332332
for (TypeElement anImpl : impl) {

‎test/langtools/jdk/javadoc/doclet/testRecordTypes/TestRecordTypes.java

+39-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8225055 8239804 8246774 8258338 8261976 8275199
26+
* @bug 8225055 8239804 8246774 8258338 8261976 8275199 8285939
2727
* @summary Record types
2828
* @library /tools/lib ../../lib
2929
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -605,4 +605,41 @@ public record Point(int x, int y) implements java.io.Serializable { }""");
605605
</ul>
606606
</section>""");
607607
}
608+
609+
@Test
610+
public void testPackageTree(Path base) throws IOException {
611+
Path src = base.resolve("src");
612+
tb.writeJavaFiles(src,
613+
"""
614+
package p;
615+
/**
616+
* A point.
617+
* @param x the x coord
618+
* @param y the y coord
619+
*/
620+
public record Point(int x, int y) { }""");
621+
622+
javadoc("-d", base.resolve("out").toString(),
623+
"-quiet", "-noindex", "--no-platform-links",
624+
"-sourcepath", src.toString(),
625+
"p");
626+
checkExit(Exit.OK);
627+
628+
checkOutput("p/package-tree.html", true,
629+
"""
630+
<section class="hierarchy">
631+
<h2 title="Record Class Hierarchy">Record Class Hierarchy</h2>
632+
<ul>
633+
<li class="circle">java.lang.Object
634+
<ul>
635+
<li class="circle">java.lang.Record
636+
<ul>
637+
<li class="circle">p.<a href="Point.html" class="type-name-link" title="class in p">Point</a></li>
638+
</ul>
639+
</li>
640+
</ul>
641+
</li>
642+
</ul>
643+
</section>""");
644+
}
608645
}

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on May 31, 2022

@openjdk-notifier[bot]
Please sign in to comment.