Skip to content

Commit e2cb0bc

Browse files
8313204: Inconsistent order of sections in generated class documentation
Reviewed-by: hannesw, prappo
1 parent 4ae75ca commit e2cb0bc

File tree

3 files changed

+54
-19
lines changed

3 files changed

+54
-19
lines changed

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

+21-4
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,20 @@ protected void buildMemberSummary(Content classContent) {
331331
}
332332

333333
protected void buildSummaries(Content target) {
334-
buildPropertiesSummary(target);
334+
// compare with buildMemberDetails:
335+
// buildPropertyDetails(detailsList);
336+
// buildEnumConstantsDetails(detailsList);
337+
// buildFieldDetails(detailsList);
338+
// buildConstructorDetails(detailsList);
339+
// buildAnnotationTypeMemberDetails(detailsList);
340+
// buildMethodDetails(detailsList);
335341
buildNestedClassesSummary(target);
342+
buildPropertiesSummary(target);
336343
buildEnumConstantsSummary(target);
337-
buildAnnotationTypeRequiredMemberSummary(target);
338-
buildAnnotationTypeOptionalMemberSummary(target);
339344
buildFieldsSummary(target);
340345
buildConstructorsSummary(target);
346+
buildAnnotationTypeRequiredMemberSummary(target);
347+
buildAnnotationTypeOptionalMemberSummary(target);
341348
buildMethodsSummary(target);
342349
}
343350

@@ -562,8 +569,18 @@ private SortedSet<? extends Element> asSortedSet(Collection<? extends Element> m
562569
protected void buildMemberDetails(Content classContent) throws DocletException {
563570
Content detailsList = getDetailsList();
564571

565-
buildEnumConstantsDetails(detailsList);
572+
// compare with buildSummaries()
573+
// buildNestedClassesSummary(target);
574+
// buildPropertiesSummary(target);
575+
// buildEnumConstantsSummary(target);
576+
// buildFieldsSummary(target);
577+
// buildConstructorsSummary(target);
578+
// buildAnnotationTypeRequiredMemberSummary(target);
579+
// buildAnnotationTypeOptionalMemberSummary(target);
580+
// buildMethodsSummary(target);
581+
566582
buildPropertyDetails(detailsList);
583+
buildEnumConstantsDetails(detailsList);
567584
buildFieldDetails(detailsList);
568585
buildConstructorDetails(detailsList);
569586
buildAnnotationTypeMemberDetails(detailsList);

test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2023, 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
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @bug 4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765 8223364
27-
8242056 8261976 8223358
27+
8242056 8261976 8223358 8313204
2828
* @summary Make sure that annotation types with 0 members does not have
2929
* extra HR tags.
3030
* @library ../../lib
@@ -185,4 +185,22 @@ public void testLinkSource() {
185185
"""
186186
<span class="modifiers">public @interface </span><span class="element-name"><a href="../src-html/pkg/AnnotationTypeField.html#line-31">AnnotationTypeField</a></span></div>""");
187187
}
188+
189+
@Test
190+
public void testSectionOrdering() {
191+
javadoc("-d", "out-3",
192+
"-linksource",
193+
"--no-platform-links",
194+
"-sourcepath", testSrc,
195+
"pkg");
196+
checkExit(Exit.OK);
197+
198+
checkOrder("pkg/AnnotationTypeField.html",
199+
"<ul class=\"summary-list\">",
200+
"<section class=\"field-summary\" id=\"field-summary\">",
201+
"<section class=\"member-summary\" id=\"annotation-interface-optional-element-summary\">",
202+
"<ul class=\"details-list\">",
203+
"<section class=\"field-details\" id=\"field-detail\">",
204+
"<section class=\"detail\" id=\"DEFAULT_NAME\">");
205+
}
188206
}

test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverrideMethods.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2023, 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 8157000 8192850 8182765 8223607 8261976 8281376
26+
* @bug 8157000 8192850 8182765 8223607 8261976 8281376 8313204
2727
* @summary test the behavior of --override-methods option
2828
* @library ../../lib
2929
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -78,13 +78,6 @@ public void testSummary() {
7878
checkExit(Exit.OK);
7979

8080
checkOrder("pkg5/Classes.C.html",
81-
// Check properties
82-
"""
83-
Properties declared in class&nbsp;pkg5.<a href="Classes.P.html""",
84-
"Classes.P",
85-
"""
86-
Classes.P.html#rateProperty">rate""",
87-
8881
// Check nested classes
8982
"Nested classes/interfaces declared in class&nbsp;pkg5.",
9083
"Classes.P",
@@ -95,6 +88,13 @@ public void testSummary() {
9588
"type parameter in Classes.P.PN",
9689
"V",
9790

91+
// Check properties
92+
"""
93+
Properties declared in class&nbsp;pkg5.<a href="Classes.P.html""",
94+
"Classes.P",
95+
"""
96+
Classes.P.html#rateProperty">rate""",
97+
9898
// Check fields
9999
"""
100100
Fields declared in class&nbsp;pkg5.<a href="Classes.P.html""",
@@ -220,16 +220,16 @@ public void testSummary() {
220220
"""
221221
Interfaces.C.html#o()"><code>Interfaces.C.o()""",
222222

223-
// Check properties
224-
"""
225-
Properties declared in interface&nbsp;pkg5.<a href="Interfaces.A.html" title="interface in pkg5">Interfaces.A</a>""",
226-
227223
// Check nested classes
228224
"Nested classes/interfaces declared in interface&nbsp;pkg5.",
229225
"Interfaces.A",
230226
"Interfaces.A.AA.html",
231227
"Interfaces.A.AA",
232228

229+
// Check properties
230+
"""
231+
Properties declared in interface&nbsp;pkg5.<a href="Interfaces.A.html" title="interface in pkg5">Interfaces.A</a>""",
232+
233233
// Check Fields
234234
"""
235235
Fields declared in interface&nbsp;pkg5.<a href="Interfaces.A.html""",

0 commit comments

Comments
 (0)