8313204: Inconsistent order of sections in generated class documentation

Reviewed-by: hannesw, prappo
This commit is contained in:
Jonathan Gibbons 2023-07-28 17:05:37 +00:00
parent 4ae75cab53
commit e2cb0bc6f1
3 changed files with 54 additions and 19 deletions

View File

@ -331,13 +331,20 @@ public class ClassWriter extends SubWriterHolderWriter {
}
protected void buildSummaries(Content target) {
buildPropertiesSummary(target);
// compare with buildMemberDetails:
// buildPropertyDetails(detailsList);
// buildEnumConstantsDetails(detailsList);
// buildFieldDetails(detailsList);
// buildConstructorDetails(detailsList);
// buildAnnotationTypeMemberDetails(detailsList);
// buildMethodDetails(detailsList);
buildNestedClassesSummary(target);
buildPropertiesSummary(target);
buildEnumConstantsSummary(target);
buildAnnotationTypeRequiredMemberSummary(target);
buildAnnotationTypeOptionalMemberSummary(target);
buildFieldsSummary(target);
buildConstructorsSummary(target);
buildAnnotationTypeRequiredMemberSummary(target);
buildAnnotationTypeOptionalMemberSummary(target);
buildMethodsSummary(target);
}
@ -562,8 +569,18 @@ public class ClassWriter extends SubWriterHolderWriter {
protected void buildMemberDetails(Content classContent) throws DocletException {
Content detailsList = getDetailsList();
buildEnumConstantsDetails(detailsList);
// compare with buildSummaries()
// buildNestedClassesSummary(target);
// buildPropertiesSummary(target);
// buildEnumConstantsSummary(target);
// buildFieldsSummary(target);
// buildConstructorsSummary(target);
// buildAnnotationTypeRequiredMemberSummary(target);
// buildAnnotationTypeOptionalMemberSummary(target);
// buildMethodsSummary(target);
buildPropertyDetails(detailsList);
buildEnumConstantsDetails(detailsList);
buildFieldDetails(detailsList);
buildConstructorDetails(detailsList);
buildAnnotationTypeMemberDetails(detailsList);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,7 @@
/*
* @test
* @bug 4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765 8223364
8242056 8261976 8223358
8242056 8261976 8223358 8313204
* @summary Make sure that annotation types with 0 members does not have
* extra HR tags.
* @library ../../lib
@ -185,4 +185,22 @@ public class TestAnnotationTypes extends JavadocTester {
"""
<span class="modifiers">public @interface </span><span class="element-name"><a href="../src-html/pkg/AnnotationTypeField.html#line-31">AnnotationTypeField</a></span></div>""");
}
@Test
public void testSectionOrdering() {
javadoc("-d", "out-3",
"-linksource",
"--no-platform-links",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOrder("pkg/AnnotationTypeField.html",
"<ul class=\"summary-list\">",
"<section class=\"field-summary\" id=\"field-summary\">",
"<section class=\"member-summary\" id=\"annotation-interface-optional-element-summary\">",
"<ul class=\"details-list\">",
"<section class=\"field-details\" id=\"field-detail\">",
"<section class=\"detail\" id=\"DEFAULT_NAME\">");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/*
* @test
* @bug 8157000 8192850 8182765 8223607 8261976 8281376
* @bug 8157000 8192850 8182765 8223607 8261976 8281376 8313204
* @summary test the behavior of --override-methods option
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -78,13 +78,6 @@ public class TestOverrideMethods extends JavadocTester {
checkExit(Exit.OK);
checkOrder("pkg5/Classes.C.html",
// Check properties
"""
Properties declared in class&nbsp;pkg5.<a href="Classes.P.html""",
"Classes.P",
"""
Classes.P.html#rateProperty">rate""",
// Check nested classes
"Nested classes/interfaces declared in class&nbsp;pkg5.",
"Classes.P",
@ -95,6 +88,13 @@ public class TestOverrideMethods extends JavadocTester {
"type parameter in Classes.P.PN",
"V",
// Check properties
"""
Properties declared in class&nbsp;pkg5.<a href="Classes.P.html""",
"Classes.P",
"""
Classes.P.html#rateProperty">rate""",
// Check fields
"""
Fields declared in class&nbsp;pkg5.<a href="Classes.P.html""",
@ -220,16 +220,16 @@ public class TestOverrideMethods extends JavadocTester {
"""
Interfaces.C.html#o()"><code>Interfaces.C.o()""",
// Check properties
"""
Properties declared in interface&nbsp;pkg5.<a href="Interfaces.A.html" title="interface in pkg5">Interfaces.A</a>""",
// Check nested classes
"Nested classes/interfaces declared in interface&nbsp;pkg5.",
"Interfaces.A",
"Interfaces.A.AA.html",
"Interfaces.A.AA",
// Check properties
"""
Properties declared in interface&nbsp;pkg5.<a href="Interfaces.A.html" title="interface in pkg5">Interfaces.A</a>""",
// Check Fields
"""
Fields declared in interface&nbsp;pkg5.<a href="Interfaces.A.html""",