changeset 55839:0530705ca300

8223364: Bad placement of anchor relative to header Reviewed-by: jjg
author hannesw
date Wed, 12 Jun 2019 13:21:25 +0200
parents 755e82641224
children ef577fa0dd10
files src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java test/langtools/jdk/javadoc/doclet/testHref/TestHref.java test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java test/langtools/jdk/javadoc/doclet/testTypeParams/TestTypeParameters.java
diffstat 20 files changed, 108 insertions(+), 173 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java	Wed Jun 12 13:21:25 2019 +0200
@@ -33,6 +33,7 @@
 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;
+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.AnnotationTypeFieldWriter;
@@ -104,9 +105,9 @@
         if (!writer.printedAnnotationFieldHeading) {
             Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
                     contents.fieldDetailsLabel);
-            memberDetailsTree.add(heading);
             memberDetailsTree.add(links.createAnchor(
                     SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
+            memberDetailsTree.add(heading);
             writer.printedAnnotationFieldHeading = true;
         }
         return memberDetailsTree;
@@ -119,9 +120,8 @@
             Content annotationDetailsTree) {
         Content annotationDocTree = new ContentBuilder();
         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
-        heading.add(name(member));
+        heading.add(links.createAnchor(name(member), new StringContent(name(member))));
         annotationDocTree.add(heading);
-        annotationDocTree.add(links.createAnchor(name(member)));
         return HtmlTree.SECTION(HtmlStyle.detail, annotationDocTree);
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Wed Jun 12 13:21:25 2019 +0200
@@ -33,6 +33,7 @@
 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;
+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.AnnotationTypeRequiredMemberWriter;
@@ -106,9 +107,9 @@
         if (!writer.printedAnnotationHeading) {
             Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
                     contents.annotationTypeDetailsLabel);
-            memberDetailsTree.add(heading);
             memberDetailsTree.add(links.createAnchor(
                     SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
+            memberDetailsTree.add(heading);
             writer.printedAnnotationHeading = true;
         }
         return memberDetailsTree;
@@ -122,10 +123,9 @@
         String simpleName = name(member);
         Content annotationDocTree = new ContentBuilder();
         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
-        heading.add(simpleName);
+        heading.add(links.createAnchor(
+                simpleName + utils.signature((ExecutableElement) member), new StringContent(simpleName)));
         annotationDocTree.add(heading);
-        annotationDocTree.add(links.createAnchor(
-                simpleName + utils.signature((ExecutableElement) member)));
         return HtmlTree.SECTION(HtmlStyle.detail, annotationDocTree);
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java	Wed Jun 12 13:21:25 2019 +0200
@@ -37,6 +37,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+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.ConstructorWriter;
@@ -122,9 +123,9 @@
         Content constructorDetailsTree = new ContentBuilder();
         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
                 contents.constructorDetailsLabel);
-        constructorDetailsTree.add(heading);
         constructorDetailsTree.add(links.createAnchor(
                 SectionName.CONSTRUCTOR_DETAIL));
+        constructorDetailsTree.add(heading);
         return constructorDetailsTree;
     }
 
@@ -137,12 +138,11 @@
         String erasureAnchor;
         Content constructorDocTree = new ContentBuilder();
         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
-        heading.add(name(constructor));
+        if ((erasureAnchor = getErasureAnchor(constructor)) != null) {
+            heading.add(links.createAnchor((erasureAnchor)));
+        }
+        heading.add(links.createAnchor(writer.getAnchor(constructor), new StringContent(name(constructor))));
         constructorDocTree.add(heading);
-        if ((erasureAnchor = getErasureAnchor(constructor)) != null) {
-            constructorDocTree.add(links.createAnchor((erasureAnchor)));
-        }
-        constructorDocTree.add(links.createAnchor(writer.getAnchor(constructor)));
         return HtmlTree.SECTION(HtmlStyle.detail, constructorDocTree);
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java	Wed Jun 12 13:21:25 2019 +0200
@@ -33,6 +33,7 @@
 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;
+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;
@@ -91,9 +92,9 @@
         Content enumConstantsDetailsTree = new ContentBuilder();
         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
                 contents.enumConstantDetailLabel);
-        enumConstantsDetailsTree.add(heading);
         enumConstantsDetailsTree.add(links.createAnchor(
                 SectionName.ENUM_CONSTANT_DETAIL));
+        enumConstantsDetailsTree.add(heading);
         return enumConstantsDetailsTree;
     }
 
@@ -105,9 +106,8 @@
             Content enumConstantsDetailsTree) {
         Content enumConstantsTree = new ContentBuilder();
         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
-        heading.add(name(enumConstant));
+        heading.add(links.createAnchor(name(enumConstant), new StringContent(name(enumConstant))));
         enumConstantsTree.add(heading);
-        enumConstantsTree.add(links.createAnchor(name(enumConstant)));
         return HtmlTree.SECTION(HtmlStyle.detail, enumConstantsTree);
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java	Wed Jun 12 13:21:25 2019 +0200
@@ -96,9 +96,9 @@
         Content fieldDetailsTree = new ContentBuilder();
         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
                 contents.fieldDetailsLabel);
-        fieldDetailsTree.add(heading);
         fieldDetailsTree.add(links.createAnchor(
                 SectionName.FIELD_DETAIL));
+        fieldDetailsTree.add(heading);
         return fieldDetailsTree;
     }
 
@@ -109,9 +109,8 @@
     public Content getFieldDocTreeHeader(VariableElement field, Content fieldDetailsTree) {
         Content fieldTree = new ContentBuilder();
         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
-        heading.add(name(field));
+        heading.add(links.createAnchor(name(field), new StringContent(name(field))));
         fieldTree.add(heading);
-        fieldTree.add(links.createAnchor(name(field)));
         return HtmlTree.SECTION(HtmlStyle.detail, fieldTree);
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java	Wed Jun 12 13:21:25 2019 +0200
@@ -109,8 +109,8 @@
         Content methodDetailsTree = new ContentBuilder();
         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
                 contents.methodDetailLabel);
+        methodDetailsTree.add(links.createAnchor(SectionName.METHOD_DETAIL));
         methodDetailsTree.add(heading);
-        methodDetailsTree.add(links.createAnchor(SectionName.METHOD_DETAIL));
         return methodDetailsTree;
     }
 
@@ -122,12 +122,11 @@
         String erasureAnchor;
         Content methodDocTree = new ContentBuilder();
         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
-        heading.add(name(method));
+        if ((erasureAnchor = getErasureAnchor(method)) != null) {
+            heading.add(links.createAnchor((erasureAnchor)));
+        }
+        heading.add(links.createAnchor(writer.getAnchor(method), new StringContent(name(method))));
         methodDocTree.add(heading);
-        if ((erasureAnchor = getErasureAnchor(method)) != null) {
-            methodDocTree.add(links.createAnchor((erasureAnchor)));
-        }
-        methodDocTree.add(links.createAnchor(writer.getAnchor(method)));
         return HtmlTree.SECTION(HtmlStyle.detail, methodDocTree);
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java	Wed Jun 12 13:21:25 2019 +0200
@@ -89,8 +89,8 @@
         Content propertyDetailsTree = new ContentBuilder();
         Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
                 contents.propertyDetailsLabel);
+        propertyDetailsTree.add(links.createAnchor(SectionName.PROPERTY_DETAIL));
         propertyDetailsTree.add(heading);
-        propertyDetailsTree.add(links.createAnchor(SectionName.PROPERTY_DETAIL));
         return propertyDetailsTree;
     }
 
@@ -102,9 +102,9 @@
             Content propertyDetailsTree) {
         Content propertyDocTree = new ContentBuilder();
         Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
-        heading.add(utils.getPropertyLabel(name(property)));
+        heading.add(links.createAnchor(name(property),
+                new StringContent(utils.getPropertyLabel(name(property)))));
         propertyDocTree.add(heading);
-        propertyDocTree.add(links.createAnchor(name(property)));
         return HtmlTree.SECTION(HtmlStyle.detail, propertyDocTree);
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java	Wed Jun 12 13:21:25 2019 +0200
@@ -100,7 +100,7 @@
      * @return a content tree for the marker anchor
      */
     public Content createAnchor(String name, Content content) {
-        return HtmlTree.A_ID(name, (content == null ? EMPTY_COMMENT : content));
+        return HtmlTree.A_ID(getName(name), (content == null ? EMPTY_COMMENT : content));
     }
 
     private static final Content EMPTY_COMMENT = new Comment(" ");
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Wed Jun 12 10:34:29 2019 +0200
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Wed Jun 12 13:21:25 2019 +0200
@@ -574,8 +574,7 @@
 div.memberSignature {
     font-family:'DejaVu Sans Mono', monospace;
     font-size:14px;
-    margin-top:6px;
-    margin-bottom:14px;
+    margin:14px 0;
     white-space: pre-wrap;
 }
 div.memberSignature span.annotations {
--- a/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java	Wed Jun 12 13:21:25 2019 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765
+ * @bug      4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765 8223364
  * @summary  Make sure that annotation types with 0 members does not have
  *           extra HR tags.
  * @author   jamieh
@@ -61,10 +61,7 @@
                 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"#DEFAULT_NAME\">DEFAULT_NAME</a></span>"
                 + "</code></th>",
                 "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->",
-                "<h3>DEFAULT_NAME</h3>\n"
-                + "<a id=\"DEFAULT_NAME\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"DEFAULT_NAME\">DEFAULT_NAME</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">static final</span>&nbsp;"
                 + "<span class=\"returnType\">java.lang.String</span>&nbsp;"
                 + "<span class=\"memberName\">DEFAULT_NAME</span></div>\n");
@@ -87,10 +84,7 @@
                     "<ul class=\"blockList\">",
                     "<li class=\"blockList\">",
                     "<section class=\"detail\">",
-                    "<h3>value</h3>",
-                    "<a id=\"value()\">",
-                    "<!--   -->",
-                    "</a>",
+                    "<h3><a id=\"value()\">value</a></h3>",
                     "<div class=\"memberSignature\"><span class=\"returnType\">int</span>"
                     + "&nbsp;<span class=\"memberName\">value</span></div>");
 
--- a/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java	Wed Jun 12 13:21:25 2019 +0200
@@ -57,13 +57,9 @@
                 //Member summary table link.
                 "href=\"#method(int,int,java.util.ArrayList)\"",
                 //Anchor test.
-                "<a id=\"method(int,int,java.util.ArrayList)\">\n"
-                + "<!--   -->\n"
-                + "</a>",
+                "<a id=\"method(int,int,java.util.ArrayList)\">",
                 //Backward compatibility anchor test."pkg/C1.html",
-                "<a id=\"method(int,int,java.util.ArrayList)\">\n"
-                + "<!--   -->\n"
-                + "</a>");
+                "<a id=\"method(int,int,java.util.ArrayList)\">");
 
         checkOutput("pkg/C2.html", true,
                 //{@link} test.
--- a/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java	Wed Jun 12 13:21:25 2019 +0200
@@ -323,21 +323,21 @@
                 + "<!--   -->\n"
                 + "</a>\n"
                 + "<h2>Method Summary</h2>",
-                "<section class=\"fieldDetails\">\n"
-                + "<h2>Field Details</h2>\n"
+                "<section class=\"fieldDetails\">"
                 + "<a id=\"field.detail\">\n"
                 + "<!--   -->\n"
-                + "</a>",
-                "<section class=\"constructorDetails\">\n"
-                + "<h2>Constructor Details</h2>\n"
+                + "</a>\n"
+                + "<h2>Field Details</h2>\n",
+                "<section class=\"constructorDetails\">"
                 + "<a id=\"constructor.detail\">\n"
                 + "<!--   -->\n"
-                + "</a>",
-                "<section class=\"methodDetails\">\n"
-                + "<h2>Method Details</h2>\n"
+                + "</a>\n"
+                + "<h2>Constructor Details</h2>\n",
+                "<section class=\"methodDetails\">"
                 + "<a id=\"method.detail\">\n"
                 + "<!--   -->\n"
-                + "</a>",
+                + "</a>\n"
+                + "<h2>Method Details</h2>\n",
                 "<footer role=\"contentinfo\">\n"
                 + "<nav role=\"navigation\">\n"
                 + "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@@ -367,16 +367,16 @@
                 + "<h2>Method Summary</h2>\n"
                 + "<div class=\"memberSummary\">\n",
                 "<table aria-labelledby=\"t0\">",
-                "<section class=\"constantDetails\">\n"
-                + "<h2>Enum Constant Details</h2>\n"
+                "<section class=\"constantDetails\">"
                 + "<a id=\"enum.constant.detail\">\n"
                 + "<!--   -->\n"
-                + "</a>\n",
-                "<section class=\"methodDetails\">\n"
-                + "<h2>Method Details</h2>\n"
+                + "</a>\n"
+                + "<h2>Enum Constant Details</h2>\n",
+                "<section class=\"methodDetails\">"
                 + "<a id=\"method.detail\">\n"
                 + "<!--   -->\n"
-                + "</a>\n",
+                + "</a>\n"
+                + "<h2>Method Details</h2>\n",
                 "<footer role=\"contentinfo\">\n"
                 + "<nav role=\"navigation\">\n"
                 + "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@@ -400,11 +400,11 @@
                 + "<h2>Method Summary</h2>\n"
                 + "<div class=\"memberSummary\">\n",
                 "<table aria-labelledby=\"t0\">\n",
-                "<section class=\"methodDetails\">\n"
-                + "<h2>Method Details</h2>\n"
+                "<section class=\"methodDetails\">"
                 + "<a id=\"method.detail\">\n"
                 + "<!--   -->\n"
-                + "</a>\n",
+                + "</a>\n"
+                + "<h2>Method Details</h2>\n",
                 "<footer role=\"contentinfo\">\n"
                 + "<nav role=\"navigation\">\n"
                 + "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@@ -426,11 +426,11 @@
                 + "<!--   -->\n"
                 + "</a>\n"
                 + "<h2>Constructor Summary</h2>",
-                "<section class=\"constructorDetails\">\n"
-                + "<h2>Constructor Details</h2>\n"
+                "<section class=\"constructorDetails\">"
                 + "<a id=\"constructor.detail\">\n"
                 + "<!--   -->\n"
-                + "</a>\n",
+                + "</a>\n"
+                + "<h2>Constructor Details</h2>\n",
                 "<footer role=\"contentinfo\">\n"
                 + "<nav role=\"navigation\">\n"
                 + "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@@ -452,11 +452,11 @@
                 + "<!--   -->\n"
                 + "</a>\n"
                 + "<h2>Constructor Summary</h2>",
-                "<section class=\"constructorDetails\">\n"
-                + "<h2>Constructor Details</h2>\n"
+                "<section class=\"constructorDetails\">"
                 + "<a id=\"constructor.detail\">\n"
                 + "<!--   -->\n"
-                + "</a>\n",
+                + "</a>\n"
+                + "<h2>Constructor Details</h2>\n",
                 "<footer role=\"contentinfo\">\n"
                 + "<nav role=\"navigation\">\n"
                 + "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@@ -484,11 +484,11 @@
                 + "</a>\n"
                 + "<h2>Optional Element Summary</h2>\n"
                 + "<div class=\"memberSummary\">\n<table>",
-                "<section class=\"memberDetails\">\n"
-                + "<h2>Element Details</h2>\n"
+                "<section class=\"memberDetails\">"
                 + "<a id=\"annotation.type.element.detail\">\n"
                 + "<!--   -->\n"
-                + "</a>\n",
+                + "</a>\n"
+                + "<h2>Element Details</h2>",
                 "<footer role=\"contentinfo\">\n"
                 + "<nav role=\"navigation\">\n"
                 + "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
--- a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java	Wed Jun 12 13:21:25 2019 +0200
@@ -124,10 +124,7 @@
                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n");
 
         checkOutput("pkg/ClassWithStaticMembers.html", true,
-                "<h3>f</h3>\n"
-                + "<a id=\"f\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"f\">f</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public static</span>&nbsp;"
                 + "<span class=\"returnType\">int</span>&nbsp;<span class=\"memberName\">f</span></div>\n"
                 + "<div class=\"block\">A hider field</div>",
@@ -139,10 +136,7 @@
                 + "<div class=\"block\">A hider method</div>\n"
                 + "</td>\n",
 
-                "<h3>staticMethod</h3>\n"
-                + "<a id=\"staticMethod()\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"staticMethod()\">staticMethod</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public static</span>&nbsp;"
                 + "<span class=\"returnType\">void</span>&nbsp;<span class=\"memberName\">staticMethod</span>()</div>\n"
                 + "<div class=\"block\"><span class=\"descfrmTypeLabel\">"
--- a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java	Wed Jun 12 13:21:25 2019 +0200
@@ -89,25 +89,16 @@
                 + "<a href=\"#pausedProperty\">paused</a></span></code></th>\n"
                 + "<td class=\"colLast\">\n"
                 + "<div class=\"block\">Defines if paused.</div>",
-                "<h3>paused</h3>\n"
-                + "<a id=\"pausedProperty\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"pausedProperty\">paused</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public final</span>&nbsp;"
                 + "<span class=\"returnType\"><a href=\"C.BooleanProperty.html\" title=\"class in pkg1\">"
                 + "C.BooleanProperty</a></span>&nbsp;<span class=\"memberName\">pausedProperty</span></div>\n"
                 + "<div class=\"block\">Defines if paused. The second line.</div>",
-                "<h3>isPaused</h3>\n"
-                + "<a id=\"isPaused()\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"isPaused()\">isPaused</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public final</span>&nbsp;"
                 + "<span class=\"returnType\">double</span>&nbsp;<span class=\"memberName\">isPaused</span>()</div>\n"
                 + "<div class=\"block\">Gets the value of the property paused.</div>",
-                "<h3>setPaused</h3>\n"
-                + "<a id=\"setPaused(boolean)\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"setPaused(boolean)\">setPaused</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public final</span>&nbsp;"
                 + "<span class=\"returnType\">void</span>&nbsp;<span class=\"memberName\">setPaused</span>&#8203;"
                 + "(<span class=\"arguments\">boolean&nbsp;value)</span></div>\n"
@@ -117,10 +108,7 @@
                 + "<dd>Defines if paused. The second line.</dd>\n"
                 + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
                 + "<dd>false</dd>",
-                "<h3>isPaused</h3>\n"
-                + "<a id=\"isPaused()\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"isPaused()\">isPaused</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public final</span>&nbsp;"
                 + "<span class=\"returnType\">double</span>&nbsp;<span class=\"memberName\">isPaused</span>()</div>\n"
                 + "<div class=\"block\">Gets the value of the property paused.</div>\n"
@@ -129,20 +117,14 @@
                 + "<dd>Defines if paused. The second line.</dd>\n"
                 + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
                 + "<dd>false</dd>",
-                "<h3>rate</h3>\n"
-                + "<a id=\"rateProperty\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"rateProperty\">rate</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public final</span>&nbsp;"
                 + "<span class=\"returnType\"><a href=\"C.DoubleProperty.html\" title=\"class in pkg1\">"
                 + "C.DoubleProperty</a></span>&nbsp;<span class=\"memberName\">rateProperty</span></div>\n"
                 + "<div class=\"block\">Defines the direction/speed at which the "
                 + "<code>Timeline</code> is expected to\n"
                 + " be played. This is the second line.</div>",
-                "<h3>setRate</h3>\n"
-                + "<a id=\"setRate(double)\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"setRate(double)\">setRate</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public final</span>&nbsp;"
                 + "<span class=\"returnType\">void</span>&nbsp;<span class=\"memberName\">setRate</span>&#8203;"
                 + "(<span class=\"arguments\">double&nbsp;value)</span></div>\n"
@@ -155,10 +137,7 @@
                 + "<dd>11</dd>\n"
                 + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
                 + "<dd>JavaFX 8.0</dd>",
-                "<h3>getRate</h3>\n"
-                + "<a id=\"getRate()\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"getRate()\">getRate</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public final</span>&nbsp;"
                 + "<span class=\"returnType\">double</span>&nbsp;<span class=\"memberName\">getRate</span>()</div>\n"
                 + "<div class=\"block\">Gets the value of the property rate.</div>\n"
@@ -225,17 +204,14 @@
                 "pkg2");
         checkExit(Exit.OK);
         checkOutput("pkg2/Test.html", true,
-                "<h2>Property Details</h2>\n"
-                + "<a id=\"property.detail\">\n"
+                "<a id=\"property.detail\">\n"
                 + "<!--   -->\n"
                 + "</a>\n"
+                + "<h2>Property Details</h2>\n"
                 + "<ul class=\"blockList\">\n"
                 + "<li class=\"blockList\">\n"
                 + "<section class=\"detail\">\n"
-                + "<h3>beta</h3>\n"
-                + "<a id=\"betaProperty\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                + "<h3><a id=\"betaProperty\">beta</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public</span>&nbsp;"
                 + "<span class=\"returnType\">java.lang.Object</span>"
                 + "&nbsp;<span class=\"memberName\">betaProperty</span></div>\n"
@@ -243,10 +219,7 @@
                 + "</li>\n"
                 + "<li class=\"blockList\">\n"
                 + "<section class=\"detail\">\n"
-                + "<h3>gamma</h3>\n"
-                + "<a id=\"gammaProperty\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                + "<h3><a id=\"gammaProperty\">gamma</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public final</span>&nbsp;"
                 + "<span class=\"returnType\">java.util.List&lt;java.lang.String&gt;</span>"
                 + "&nbsp;<span class=\"memberName\">gammaProperty</span></div>\n"
@@ -254,10 +227,7 @@
                 + "</li>\n"
                 + "<li class=\"blockList\">\n"
                 + "<section class=\"detail\">\n"
-                + "<h3>delta</h3>\n"
-                + "<a id=\"deltaProperty\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                + "<h3><a id=\"deltaProperty\">delta</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public final</span>&nbsp;"
                 + "<span class=\"returnType\">java.util.List&lt;java.util.Set&lt;? super java.lang.Object&gt;&gt;"
                 + "</span>&nbsp;<span class=\"memberName\">deltaProperty</span></div>\n"
--- a/test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java	Wed Jun 12 13:21:25 2019 +0200
@@ -73,8 +73,6 @@
         checkOutput("pkg2/A.html", true,
                 "<a id=\"f(java.lang.Object[])\">\n"
                 + "<!--   -->\n"
-                + "</a><a id=\"f(T[])\">\n"
-                + "<!--   -->\n"
-                + "</a>");
+                + "</a><a id=\"f(T[])\">f</a>");
     }
 }
--- a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java	Wed Jun 12 13:21:25 2019 +0200
@@ -193,17 +193,11 @@
                 "<pre>@Documented\npublic @interface <a href="
                 + "\"../src-html/linksource/AnnotationTypeField.html#line.31\">"
                 + "AnnotationTypeField</a></pre>",
-                "<h3>DEFAULT_NAME</h3>\n"
-                + "<a id=\"DEFAULT_NAME\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"DEFAULT_NAME\">DEFAULT_NAME</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">static final</span>&nbsp;"
                 + "<span class=\"returnType\">java.lang.String</span>&nbsp;<span class=\"memberName\">"
                 + "<a href=\"../src-html/linksource/AnnotationTypeField.html#line.32\">DEFAULT_NAME</a></span></div>",
-                "<h3>name</h3>\n"
-                + "<a id=\"name()\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                "<h3><a id=\"name()\">name</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"returnType\">java.lang.String</span>&nbsp;"
                 + "<span class=\"memberName\"><a href=\"../src-html/linksource/AnnotationTypeField.html#line.34\">"
                 + "name</a></span></div>");
--- a/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java	Wed Jun 12 13:21:25 2019 +0200
@@ -532,10 +532,10 @@
                     "<a href=\"#three()\">three</a>",
                     "<a href=\"#two()\">two</a>",
                     "<h2>Element Details</h2>",
-                    "<h3>one</h3>",
-                    "<h3>two</h3>",
-                    "<h3>three</h3>",
-                    "<h3>four</h3>");
+                    "<h3><a id=\"one()\">one</a></h3>",
+                    "<h3><a id=\"two()\">two</a></h3>",
+                    "<h3><a id=\"three()\">three</a></h3>",
+                    "<h3><a id=\"four()\">four</a></h3>");
 
             checkOrder("pkg5/AnnoRequiredTest.html",
                     "<h2>Required Element Summary</h2>",
@@ -544,10 +544,10 @@
                     "<a href=\"#three()\">three</a>",
                     "<a href=\"#two()\">two</a>",
                     "<h2>Element Details</h2>",
-                    "<h3>one</h3>",
-                    "<h3>two</h3>",
-                    "<h3>three</h3>",
-                    "<h3>four</h3>");
+                    "<h3><a id=\"one()\">one</a></h3>",
+                    "<h3><a id=\"two()\">two</a></h3>",
+                    "<h3><a id=\"three()\">three</a></h3>",
+                    "<h3><a id=\"four()\">four</a></h3>");
 
             checkOrder("pkg5/CtorTest.html",
                     "<h2>Constructor Summary</h2>",
@@ -568,10 +568,10 @@
                     "<a href=\"#THREE\">THREE</a>",
                     "<a href=\"#TWO\">TWO</a>",
                     "<h2>Enum Constant Details</h2>",
-                    "<h3>ONE</h3>",
-                    "<h3>TWO</h3>",
-                    "<h3>THREE</h3>",
-                    "<h3>FOUR</h3>");
+                    "<h3><a id=\"ONE\">ONE</a></h3>",
+                    "<h3><a id=\"TWO\">TWO</a></h3>",
+                    "<h3><a id=\"THREE\">THREE</a></h3>",
+                    "<h3><a id=\"FOUR\">FOUR</a></h3>");
 
             checkOrder("pkg5/FieldTest.html",
                     "<h2>Field Summary</h2>",
@@ -580,10 +580,10 @@
                     "<a href=\"#three\">three</a>",
                     "<a href=\"#two\">two</a>",
                     "<h2>Field Details</h2>",
-                    "<h3>one</h3>",
-                    "<h3>two</h3>",
-                    "<h3>three</h3>",
-                    "<h3>four</h3>");
+                    "<h3><a id=\"one\">one</a></h3>",
+                    "<h3><a id=\"two\">two</a></h3>",
+                    "<h3><a id=\"three\">three</a></h3>",
+                    "<h3><a id=\"four\">four</a></h3>");
 
             checkOrder("pkg5/IntfTest.html",
                     "<h2>Method Summary</h2>",
@@ -592,10 +592,10 @@
                     "<a href=\"#three()\">three</a>",
                     "<a href=\"#two()\">two</a>",
                     "<h2>Method Details</h2>",
-                    "<h3>one</h3>",
-                    "<h3>two</h3>",
-                    "<h3>three</h3>",
-                    "<h3>four</h3>");
+                    "<h3><a id=\"one()\">one</a></h3>",
+                    "<h3><a id=\"two()\">two</a></h3>",
+                    "<h3><a id=\"three()\">three</a></h3>",
+                    "<h3><a id=\"four()\">four</a></h3>");
 
             checkOrder("pkg5/MethodTest.html",
                     "<h2>Method Summary</h2>",
@@ -604,10 +604,10 @@
                     "<a href=\"#three()\">three</a>",
                     "<a href=\"#two()\">two</a>",
                     "<h2>Method Details</h2>",
-                    "<h3>one</h3>",
-                    "<h3>two</h3>",
-                    "<h3>three</h3>",
-                    "<h3>four</h3>");
+                    "<h3><a id=\"one()\">one</a></h3>",
+                    "<h3><a id=\"two()\">two</a></h3>",
+                    "<h3><a id=\"three()\">three</a></h3>",
+                    "<h3><a id=\"four()\">four</a></h3>");
 
             checkOrder("pkg5/PropertyTest.html",
                     "<h2>Property Summary</h2>",
@@ -616,10 +616,10 @@
                     "<a href=\"#threeProperty\">three</a>",
                     "<a href=\"#twoProperty\">two</a>",
                     "<h2>Property Details</h2>",
-                    "<h3>oneProperty</h3>",
-                    "<h3>twoProperty</h3>",
-                    "<h3>threeProperty</h3>",
-                    "<h3>fourProperty</h3>");
+                    "<h3><a id=\"oneProperty()\">oneProperty</a></h3>",
+                    "<h3><a id=\"twoProperty()\">twoProperty</a></h3>",
+                    "<h3><a id=\"threeProperty()\">threeProperty</a></h3>",
+                    "<h3><a id=\"fourProperty()\">fourProperty</a></h3>");
 
         }
     }
--- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java	Wed Jun 12 13:21:25 2019 +0200
@@ -53,10 +53,7 @@
 
         checkOutput("pkg4/Foo.html", true,
                 "<section class=\"detail\">\n"
-                + "<h3>toString</h3>\n"
-                + "<a id=\"toString()\">\n"
-                + "<!--   -->\n"
-                + "</a>\n"
+                + "<h3><a id=\"toString()\">toString</a></h3>\n"
                 + "<div class=\"memberSignature\"><span class=\"modifiers\">public</span>&nbsp;"
                 + "<span class=\"returnType\">void</span>&nbsp;<span class=\"memberName\">toString</span>()</div>\n"
                 + "<div class=\"block\">Why can't I do this ?</div>\n"
--- a/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java	Wed Jun 12 13:21:25 2019 +0200
@@ -86,10 +86,7 @@
         // make sure the second @summary's content is displayed correctly
         checkOutput("p1/A.html", true,
              "<section class=\"detail\">\n"
-             + "<h3>m3</h3>\n"
-             + "<a id=\"m3()\">\n"
-             + "<!--   -->\n"
-             + "</a>\n"
+             + "<h3><a id=\"m3()\">m3</a></h3>\n"
              + "<div class=\"memberSignature\"><span class=\"modifiers\">public</span>&nbsp;"
              + "<span class=\"returnType\">void</span>&nbsp;<span class=\"memberName\">m3</span>()</div>\n"
              + "<div class=\"block\">First sentence  some text maybe second sentence.</div>\n"
--- a/test/langtools/jdk/javadoc/doclet/testTypeParams/TestTypeParameters.java	Wed Jun 12 10:34:29 2019 +0200
+++ b/test/langtools/jdk/javadoc/doclet/testTypeParams/TestTypeParameters.java	Wed Jun 12 13:21:25 2019 +0200
@@ -70,9 +70,7 @@
 
         // Nested type parameters
         checkOutput("pkg/C.html", true,
-                "<a id=\"formatDetails(java.util.Collection,java.util.Collection)\">\n"
-                + "<!--   -->\n"
-                + "</a>");
+                "<a id=\"formatDetails(java.util.Collection,java.util.Collection)\">");
     }
 
     @Test