8220087: Remove remnants of HTML4 support

Reviewed-by: jjg
This commit is contained in:
Priya Lakshmi Muthuswamy 2019-03-11 14:57:16 +05:30
parent 0b082fcc1d
commit e5f0f8d005
7 changed files with 13 additions and 117 deletions

View File

@ -41,8 +41,6 @@ import com.sun.tools.doclint.DocLint;
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.WriterFactory;
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 @@ public class HtmlConfiguration extends BaseConfiguration {
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;
}

View File

@ -36,8 +36,6 @@ package jdk.javadoc.internal.doclets.formats.html.markup;
* @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;

View File

@ -44,16 +44,13 @@ public enum HtmlTag {
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 @@ public enum HtmlTag {
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 @@ public enum HtmlTag {
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 @@ public enum HtmlTag {
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 @@ public enum HtmlTag {
}
HtmlTag() {
this(HtmlVersion.ALL, BlockType.BLOCK, EndTag.END);
this(BlockType.BLOCK, EndTag.END);
}
HtmlTag(HtmlVersion htmlVersion) {
this(htmlVersion, 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 @@ public enum HtmlTag {
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;
}

View File

@ -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
}

View File

@ -62,7 +62,6 @@ public class Links {
/**
* 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 @@ public class Links {
/**
* 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 @@ public class Links {
/**
* 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 @@ public class Links {
/**
* 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,

View File

@ -112,7 +112,7 @@ public class WorkArounds {
}
// 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 @@ public class WorkArounds {
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();

View File

@ -144,7 +144,7 @@ public class TestNavigation extends JavadocTester {
+ "</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",
@ -155,39 +155,6 @@ public class TestNavigation extends JavadocTester {
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"
+ "<!-- ======== 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"
@ -212,7 +179,7 @@ public class TestNavigation extends JavadocTester {
}
@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 @@ public class TestNavigation extends JavadocTester {
"package pkg1; public interface InterfaceWithNoMembers {\n"
+ "}");
javadoc("-d", "out-4",
javadoc("-d", "out-3",
"-sourcepath", src.toString(),
"pkg1");
checkExit(Exit.OK);