diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java index 9f1a0d5defa..ed14d3604cf 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java @@ -910,14 +910,14 @@ public class HtmlDocletWriter extends HtmlDocWriter { /** * Get the marker anchor which will be added to the documentation tree. * - * @param anchorName the anchor name attribute + * @param anchorName the anchor name or id attribute * @param anchorContent the content that should be added to the anchor * @return a content tree for the marker anchor */ public Content getMarkerAnchor(String anchorName, Content anchorContent) { if (anchorContent == null) anchorContent = new Comment(" "); - Content markerAnchor = HtmlTree.A_ID(anchorName, anchorContent); + Content markerAnchor = HtmlTree.A(configuration.htmlVersion, anchorName, anchorContent); return markerAnchor; } diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java index 796d5094304..2c8f185d981 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java @@ -264,7 +264,8 @@ public class SourceToHTMLConverter { */ private void addLine(Content pre, String line, int currentLineNo) { if (line != null) { - Content anchor = HtmlTree.A_ID("line." + Integer.toString(currentLineNo), + Content anchor = HtmlTree.A(configuration.htmlVersion, + "line." + Integer.toString(currentLineNo), new StringContent(utils.replaceTabs(configuration, line))); pre.addContent(anchor); pre.addContent(NEW_LINE); diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java index 2abe58393a0..fd02a46160d 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java @@ -226,15 +226,19 @@ public class HtmlTree extends Content { } /** - * Generates an HTML anchor tag with id attribute and content. + * Generates an HTML anchor tag with an id or a name attribute and content. * - * @param id id for the anchor tag + * @param htmlVersion the version of the generated HTML + * @param attr name or id attribute for the anchor tag * @param body content for the anchor tag * @return an HtmlTree object */ - public static HtmlTree A_ID(String id, Content body) { + public static HtmlTree A(HtmlVersion htmlVersion, String attr, Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.A); - htmltree.addAttr(HtmlAttr.ID, nullCheck(id)); + htmltree.addAttr((htmlVersion == HtmlVersion.HTML4) + ? HtmlAttr.NAME + : HtmlAttr.ID, + nullCheck(attr)); htmltree.addContent(nullCheck(body)); return htmltree; } @@ -846,7 +850,8 @@ public class HtmlTree extends Content { public boolean isValid() { switch (htmlTag) { case A : - return (hasAttr(HtmlAttr.ID) || (hasAttr(HtmlAttr.HREF) && hasContent())); + return (hasAttr(HtmlAttr.NAME) || hasAttr(HtmlAttr.ID) || (hasAttr(HtmlAttr.HREF) + && hasContent())); case BR : return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR))); case IFRAME : diff --git a/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java b/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java index 146de8b3d30..ce17788098f 100644 --- a/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java +++ b/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4638136 7198273 8025633 + * @bug 4638136 7198273 8025633 8081854 * @summary Add ability to skip over nav bar for accessibility * @author dkramer * @library ../lib @@ -50,14 +50,14 @@ public class AccessSkipNav extends JavadocTester { checkOutput("p1/C1.html", true, // Top navbar "Skip navigation links", - // Top navbar - "\n" + // Top navbar + "\n" + "\n" + "", // Bottom navbar "Skip navigation links", - // Bottom navbar - "\n" + // Bottom navbar + "\n" + "\n" + ""); diff --git a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java index ad2e3c7fd2a..f04ad41f44d 100644 --- a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java +++ b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8025633 8025524 + * @bug 8025633 8025524 8081854 * @summary Test for valid name attribute in HTML anchors. * @author Bhavesh Patel * @library ../lib @@ -54,15 +54,15 @@ public class TestAnchorNames extends JavadocTester { // Test some section markers and links to these markers checkOutput("pkg1/RegClass.html", true, - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", ""); // Test some members and link to these members @@ -73,59 +73,59 @@ public class TestAnchorNames extends JavadocTester { // Test some fields checkOutput("pkg1/RegClass.html", true, - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", ""); checkOutput("pkg1/DeprMemClass.html", true, - "", + "", ""); // Test constructor checkOutput("pkg1/RegClass.html", true, - "", + "", ""); // Test some methods checkOutput("pkg1/RegClass.html", true, - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", ""); checkOutput("pkg1/DeprMemClass.html", true, - "", + "", ""); // Test enum checkOutput("pkg1/RegClass.Te$t_Enum.html", true, - "", + "", ""); // Test nested class checkOutput("pkg1/RegClass._NestedClas$.html", true, - "", + "", ""); // Test class use page @@ -144,11 +144,11 @@ public class TestAnchorNames extends JavadocTester { // Test serialized form page checkOutput("serialized-form.html", true, //This is the marker for the link that appears in the pkg1.RegClass.html page - ""); + ""); // Test member name index page checkOutput("index-all.html", true, - "", + "", "$", "_"); diff --git a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java index 7cee70e780f..9061e1082b7 100644 --- a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java +++ b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8025633 + * @bug 8025633 8081854 * @summary Make sure that annotations types with optional elements have * element headers * @author Mahmood Ali @@ -48,6 +48,6 @@ public class TestAnnotationOptional extends JavadocTester { checkExit(Exit.OK); checkOutput("pkg/AnnotationOptional.html", true, - ""); + ""); } } diff --git a/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java b/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java index c6e2ebdd425..176a1f78878 100644 --- a/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java +++ b/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8025524 8031625 + * @bug 8025524 8031625 8081854 * @summary Test for constructor name which should be a non-qualified name. * @author Bhavesh Patel * @library ../lib @@ -59,21 +59,21 @@ public class TestConstructors extends JavadocTester { + "" + "NestedInner(int)", "Outer()", - "", + "", "Outer(int i)", - ""); + ""); checkOutput("pkg1/Outer.Inner.html", true, "Inner()", - "", + "", "Inner(int i)", - ""); + ""); checkOutput("pkg1/Outer.Inner.NestedInner.html", true, "NestedInner()", - "", + "", "NestedInner(int i)", - ""); + ""); checkOutput("pkg1/Outer.Inner.html", false, "Outer.Inner--", diff --git a/langtools/test/com/sun/javadoc/testHref/TestHref.java b/langtools/test/com/sun/javadoc/testHref/TestHref.java index 47779dc0001..aebb73a1445 100644 --- a/langtools/test/com/sun/javadoc/testHref/TestHref.java +++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4663254 8016328 8025633 8026567 + * @bug 4663254 8016328 8025633 8026567 8081854 * @summary Verify that spaces do not appear in hrefs and anchors. * @author jamieh * @library ../lib @@ -54,11 +54,11 @@ public class TestHref extends JavadocTester { //Member summary table link. "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"", //Anchor test. - "\n" + "\n" + "\n" + "", //Backward compatibility anchor test."pkg/C1.html", - "\n" + "\n" + "\n" + ""); diff --git a/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java b/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java index 0cf4d9be40b..88c76f00b5b 100644 --- a/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java +++ b/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8072945 + * @bug 8072945 8081854 * @summary Test the version of HTML generated by the javadoc tool. * @author bpatel * @library ../lib @@ -1172,7 +1172,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("overview-summary.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1194,7 +1194,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("pkg/package-summary.html", true, "", "\n" + "\n" + "\n" + "", "
", @@ -1208,7 +1208,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("pkg/package-tree.html", true, "", "\n" + "\n" + "\n" + "", "
  • "); @@ -1217,7 +1217,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("pkg1/package-use.html", true, "", "\n" + "\n" + "\n" + "", "
  • "); @@ -1234,7 +1234,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("pkg/compact1-package-summary.html", true, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1248,7 +1248,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("compact1-summary.html", true, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1262,7 +1262,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("constant-values.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1273,7 +1273,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("deprecated-list.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1295,7 +1295,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("serialized-form.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1307,7 +1307,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("overview-tree.html", true, "", "\n" + "\n" + "\n" + "", "
  • ", @@ -1326,7 +1326,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("index-all.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1342,7 +1342,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("help-doc.html", true, "", "\n" + "\n" + "\n" + "", "\n" @@ -1359,54 +1359,54 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("pkg/AnotherClass.html", true, "", "\n" + "\n" + "\n" + "", "\n" + "
    ", "\n" + "
  • ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", "\n" + "
    ", - "
  • \n" + "
  • \n" + "\n" + "\n" + "

    Uses of RegClass in pkg

    \n" @@ -1623,7 +1623,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("overview-summary.html", false, "", "\n" + "\n" + "\n" + "", "
  • \n" @@ -1662,7 +1662,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("pkg/package-summary.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1681,7 +1681,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("pkg/package-tree.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1705,7 +1705,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("pkg1/package-use.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1742,7 +1742,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("pkg/compact1-package-summary.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1761,7 +1761,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("compact1-summary.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1782,7 +1782,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("constant-values.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1803,7 +1803,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("deprecated-list.html", false, "", "\n" + "\n" + "\n" + "", "
    ", @@ -1820,7 +1820,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("serialized-form.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1838,7 +1838,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("overview-tree.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1862,7 +1862,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("index-all.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1884,7 +1884,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("help-doc.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1906,7 +1906,7 @@ public class TestHtmlVersion extends JavadocTester { checkOutput("pkg/AnotherClass.html", false, "", "\n" + "\n" + "\n" + "", "
    \n" @@ -1916,46 +1916,46 @@ public class TestHtmlVersion extends JavadocTester { + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", "
    \n" + "
    ", - "
    \n" + "
    \n" + "\n" + "\n" + "

    Uses of RegClass in pkg

    \n" diff --git a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java index 4ea77916055..fca7722169a 100644 --- a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java +++ b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7112427 8012295 8025633 8026567 8061305 + * @bug 7112427 8012295 8025633 8026567 8061305 8081854 * @summary Test of the JavaFX doclet features. * @author jvalenta * @library ../lib @@ -100,11 +100,11 @@ public class TestJavaFX extends JavadocTester { "pkg2"); checkExit(Exit.OK); checkOutput("pkg2/Test.html", true, - "
  • \n" + "
  • \n" + "\n" + "\n" + "

    Property Detail

    \n" - + "\n" + + "\n" + "\n" + "\n" + "
      \n" @@ -113,7 +113,7 @@ public class TestJavaFX extends JavadocTester { + "
      public java.lang.Object betaProperty
      \n" + "\n" + "
    \n" - + "\n" + + "\n" + "\n" + "\n" + "
      \n" @@ -123,7 +123,7 @@ public class TestJavaFX extends JavadocTester { + "java.lang.String> gammaProperty\n" + "\n" + "
    \n" - + "\n" + + "\n" + "\n" + "\n" + "
  • "