8220087: Remove remnants of HTML4 support
authorpmuthuswamy
Mon, 11 Mar 2019 14:57:16 +0530
changeset 54051 9a1dd1203a4f
parent 54050 95978e7e8da0
child 54052 a2d3ca8062b9
8220087: Remove remnants of HTML4 support Reviewed-by: jjg
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/DocType.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTag.java
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlVersion.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/WorkArounds.java
test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java	Mon Mar 11 14:22:23 2019 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java	Mon Mar 11 14:57:16 2019 +0530
@@ -41,8 +41,6 @@
 
 import jdk.javadoc.doclet.Doclet;
 import jdk.javadoc.doclet.DocletEnvironment;
-import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
-import jdk.javadoc.internal.doclets.formats.html.markup.HtmlVersion;
 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
 import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
@@ -51,7 +49,6 @@
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
-import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 import static javax.tools.Diagnostic.Kind.*;
 
@@ -359,8 +356,7 @@
         docPaths = new DocPaths(utils, useModuleDirectories);
         setCreateOverview();
         setTopFile(docEnv);
-        workArounds.initDocLint(doclintOpts.values(), tagletManager.getAllTagletNames(),
-                Utils.toLowerCase(HtmlVersion.HTML5.name()));
+        workArounds.initDocLint(doclintOpts.values(), tagletManager.getAllTagletNames());
         return true;
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/DocType.java	Mon Mar 11 14:22:23 2019 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/DocType.java	Mon Mar 11 14:57:16 2019 +0530
@@ -36,8 +36,6 @@
  * @author Bhavesh Patel
  */
 public enum DocType {
-    HTML4_TRANSITIONAL("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" "
-            + "\"http://www.w3.org/TR/html4/loose.dtd\">"),
     HTML5("<!DOCTYPE HTML>");
 
     public final String text;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTag.java	Mon Mar 11 14:22:23 2019 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTag.java	Mon Mar 11 14:57:16 2019 +0530
@@ -44,16 +44,13 @@
     BODY(BlockType.OTHER, EndTag.END),
     BR(BlockType.INLINE, EndTag.NOEND),
     CAPTION,
-    CENTER(HtmlVersion.HTML4),
     CODE(BlockType.INLINE, EndTag.END),
     DD,
-    DIR(HtmlVersion.HTML4),
     DIV,
     DL,
     DT,
     EM(BlockType.INLINE, EndTag.END),
-    FONT(HtmlVersion.HTML4, BlockType.INLINE, EndTag.END),
-    FOOTER(HtmlVersion.HTML5),
+    FOOTER,
     H1,
     H2,
     H3,
@@ -61,7 +58,7 @@
     H5,
     H6,
     HEAD(BlockType.OTHER, EndTag.END),
-    HEADER(HtmlVersion.HTML5),
+    HEADER,
     HR(BlockType.BLOCK, EndTag.NOEND),
     HTML(BlockType.OTHER, EndTag.END),
     I(BlockType.INLINE, EndTag.END),
@@ -72,16 +69,16 @@
     LI,
     LISTING,
     LINK(BlockType.OTHER, EndTag.NOEND),
-    MAIN(HtmlVersion.HTML5),
+    MAIN,
     MENU,
     META(BlockType.OTHER, EndTag.NOEND),
-    NAV(HtmlVersion.HTML5),
+    NAV,
     NOSCRIPT(BlockType.OTHER, EndTag.END),
     OL,
     P,
     PRE,
     SCRIPT(BlockType.OTHER, EndTag.END),
-    SECTION(HtmlVersion.HTML5),
+    SECTION,
     SMALL(BlockType.INLINE, EndTag.END),
     SPAN(BlockType.INLINE, EndTag.END),
     STRONG(BlockType.INLINE, EndTag.END),
@@ -92,13 +89,11 @@
     TH,
     TITLE(BlockType.OTHER, EndTag.END),
     TR,
-    TT(HtmlVersion.HTML4, BlockType.INLINE, EndTag.END),
     UL;
 
     public final BlockType blockType;
     public final EndTag endTag;
     public final String value;
-    public final HtmlVersion htmlVersion;
 
     /**
      * Enum representing the type of HTML element.
@@ -118,19 +113,10 @@
     }
 
     HtmlTag() {
-        this(HtmlVersion.ALL, BlockType.BLOCK, EndTag.END);
-    }
-
-    HtmlTag(HtmlVersion htmlVersion) {
-        this(htmlVersion, BlockType.BLOCK, EndTag.END);
+        this(BlockType.BLOCK, EndTag.END);
     }
 
-    HtmlTag(BlockType blockType, EndTag endTag ) {
-        this(HtmlVersion.ALL, blockType, endTag);
-    }
-
-    HtmlTag(HtmlVersion htmlVersion, BlockType blockType, EndTag endTag ) {
-        this.htmlVersion = htmlVersion;
+    HtmlTag(BlockType blockType, EndTag endTag) {
         this.blockType = blockType;
         this.endTag = endTag;
         this.value = Utils.toLowerCase(name());
@@ -146,16 +132,6 @@
         return (endTag == EndTag.END);
     }
 
-    /**
-     * Returns true if the tag is allowed in the output HTML version of this javadoc run.
-     *
-     * @param htmlVer the output HTML version for this javadoc run
-     * @return true if the tag is allowed
-     */
-    public boolean allowTag(HtmlVersion htmlVer) {
-        return (this.htmlVersion == HtmlVersion.ALL || this.htmlVersion == htmlVer);
-    }
-
     public String toString() {
         return value;
     }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlVersion.java	Mon Mar 11 14:22:23 2019 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2015, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.formats.html.markup;
-
-/**
- * Enum representing the version of HTML generated by javadoc.
- *
- * @author Bhavesh Patel
- */
-public enum HtmlVersion {
-    HTML4,
-    HTML5,
-    ALL
-}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java	Mon Mar 11 14:22:23 2019 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java	Mon Mar 11 14:57:16 2019 +0530
@@ -62,7 +62,6 @@
 
     /**
      * Creates an anchor of the form {@code <a id="name"><!-- --></a>}.
-     * In HTML4, a {@code name} attribute will be generated instead of an {@code id} attribute.
      *
      * @param name the value for the {@code id} or {@code name} attribute
      * @return a content tree for the anchor
@@ -73,7 +72,6 @@
 
     /**
      * Creates an anchor of the form {@code <a id="sectionName"><!-- --></a>}.
-     * In HTML4, a {@code name} attribute will be generated instead of an {@code id} attribute.
      *
      * @param sectionName the value for the {@code id} or {@code name} attribute
      * @return a content tree for the anchor
@@ -84,7 +82,6 @@
 
     /**
      * Creates an anchor of the form {@code <a id="sectionNameName"><!-- --></a>}.
-     * In HTML4, a {@code name} attribute will be generated instead of an {@code id} attribute.
      *
      * @param sectionName the first part of the value for the {@code id} or {@code name} attribute
      * @param name the second part of the value for the {@code id} or {@code name} attribute
@@ -96,7 +93,6 @@
 
     /**
      * Creates an anchor of the form {@code <a id="anchorName">content</a>}.
-     * In HTML4, a {@code name} attribute will be generated instead of an {@code id} attribute.
      *
      * @param name the value for the {@code id} or {@code name} attribute
      * @param content the content that should be added to the anchor,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java	Mon Mar 11 14:22:23 2019 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java	Mon Mar 11 14:57:16 2019 +0530
@@ -112,7 +112,7 @@
     }
 
     // TODO: fix this up correctly
-    public void initDocLint(Collection<String> opts, Collection<String> customTagNames, String htmlVersion) {
+    public void initDocLint(Collection<String> opts, Collection<String> customTagNames) {
         ArrayList<String> doclintOpts = new ArrayList<>();
         boolean msgOptionSeen = false;
 
@@ -137,7 +137,7 @@
             sep = DocLint.SEPARATOR;
         }
         doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());
-        doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + htmlVersion);
+        doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + "html5");
 
         JavacTask t = BasicJavacTask.instance(toolEnv.context);
         doclint = new DocLint();
--- a/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java	Mon Mar 11 14:22:23 2019 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java	Mon Mar 11 14:57:16 2019 +0530
@@ -144,7 +144,7 @@
                 + "</nav>");
     }
 
-    // Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified for HTML4.
+    // Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified.
     @Test
     public void test2(Path ignore) {
         javadoc("-d", "out-2",
@@ -163,39 +163,6 @@
                 + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
                 + "//-->\n"
                 + "</script>\n"
-                + "<!-- ======== START OF CLASS DATA ======== -->");
-
-        checkOutput("pkg/package-summary.html", false,
-                "<!-- ========= END OF TOP NAVBAR ========= -->\n"
-                + "</div>\n"
-                + "<div class=\"navPadding\">&nbsp;</div>\n"
-                + "<script type=\"text/javascript\"><!--\n"
-                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
-                + "//-->\n"
-                + "</script>\n"
-                + "<div class=\"header\">");
-    }
-
-    // Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified for HTML5.
-    @Test
-    public void test3(Path ignore) {
-        javadoc("-d", "out-3",
-                "-html5",
-                "-nonavbar",
-                "--frames",
-                "-sourcepath", testSrc,
-                "pkg");
-        checkExit(Exit.OK);
-        checkSubNav();
-
-        checkOutput("pkg/A.html", false,
-                "<!-- ========= END OF TOP NAVBAR ========= -->\n"
-                + "</div>\n"
-                + "<div class=\"navPadding\">&nbsp;</div>\n"
-                + "<script type=\"text/javascript\"><!--\n"
-                + "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
-                + "//-->\n"
-                + "</script>\n"
                 + "</nav>\n"
                 + "</header>\n"
                 + "<!-- ======== START OF CLASS DATA ======== -->");
@@ -212,7 +179,7 @@
     }
 
     @Test
-    public void test4(Path base) throws IOException {
+    public void test3(Path base) throws IOException {
         Path src = base.resolve("src");
         tb.writeJavaFiles(src,
                 "package pkg1; public class A {\n"
@@ -255,7 +222,7 @@
                 "package pkg1; public interface InterfaceWithNoMembers {\n"
                 + "}");
 
-        javadoc("-d", "out-4",
+        javadoc("-d", "out-3",
                 "-sourcepath", src.toString(),
                 "pkg1");
         checkExit(Exit.OK);