8190822: Remove dead code that could lead to invalid HTML

Reviewed-by: bpatel, ksrini
This commit is contained in:
Jonathan Gibbons 2017-11-16 15:17:47 -08:00
parent 29cd769953
commit 70c7792638
4 changed files with 10 additions and 35 deletions

View File

@ -1089,12 +1089,11 @@ public class HtmlDocletWriter extends HtmlDocWriter {
* be null or empty string if no member is being referenced.
* @param label the label for the external link.
* @param strong true if the link should be strong.
* @param style the style of the link.
* @param code true if the label should be code font.
* @return the link
*/
public Content getCrossClassLink(String qualifiedClassName, String refMemName,
Content label, boolean strong, String style,
boolean code) {
Content label, boolean strong, boolean code) {
String className = "";
String packageName = qualifiedClassName == null ? "" : qualifiedClassName;
int periodIndex;
@ -1117,8 +1116,8 @@ public class HtmlDocletWriter extends HtmlDocWriter {
className + ".html", refMemName);
return Links.createLink(link,
(label == null) || label.isEmpty() ? defaultLabel : label,
strong, style,
configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName),
strong,
resources.getText("doclet.Href_Class_Or_Interface_Title", packageName),
"");
}
}
@ -1407,7 +1406,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return Links.createLink(packageCrossLink,
(label.isEmpty() ? text : label));
} else if ((classCrossLink = getCrossClassLink(refClassName,
refMemName, label, false, "", !isLinkPlain)) != null) {
refMemName, label, false, !isLinkPlain)) != null) {
// Class cross link found (possibly to a member in the class)
return classCrossLink;
} else {

View File

@ -97,7 +97,6 @@ public class LinkFactoryImpl extends LinkFactory {
filename.fragment(classLinkInfo.where),
label,
classLinkInfo.isStrong,
classLinkInfo.styleName,
title,
classLinkInfo.target));
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
@ -109,8 +108,7 @@ public class LinkFactoryImpl extends LinkFactory {
} else {
Content crossLink = m_writer.getCrossClassLink(
typeElement.getQualifiedName().toString(), classLinkInfo.where,
label, classLinkInfo.isStrong, classLinkInfo.styleName,
true);
label, classLinkInfo.isStrong, true);
if (crossLink != null) {
link.addContent(crossLink);
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {

View File

@ -230,11 +230,6 @@ public class LinkInfoImpl extends LinkInfo {
*/
public String where = "";
/**
* String style of text defined in style sheet.
*/
public String styleName = "";
/**
* The value of the target.
*/
@ -315,15 +310,6 @@ public class LinkInfoImpl extends LinkInfo {
return this;
}
/**
* Set the style to be used for the link.
* @param styleName String style of text defined in style sheet.
*/
public LinkInfoImpl styleName(String styleName) {
this.styleName = styleName;
return this;
}
/**
* Set the target to be used for the link.
* @param target the target name.
@ -443,7 +429,6 @@ public class LinkInfoImpl extends LinkInfo {
return "LinkInfoImpl{" +
"context=" + context +
", where=" + where +
", styleName=" + styleName +
", target=" + target +
super.toString() + '}';
}

View File

@ -170,7 +170,7 @@ public class Links {
* @return a content tree for the link
*/
public static Content createLink(DocPath path, String label) {
return Links.createLink(path, new StringContent(label), false, "", "", "");
return Links.createLink(path, new StringContent(label), false, "", "");
}
/**
@ -192,14 +192,13 @@ public class Links {
* @param path the path for the link
* @param label the content for the link
* @param strong whether to wrap the {@code label} in a SPAN element
* @param stylename (deprecated)
* @param title the title for the link
* @param target the target for the link, or null
* @return a content tree for the link
*/
public static Content createLink(DocPath path, Content label, boolean strong, String stylename,
public static Content createLink(DocPath path, Content label, boolean strong,
String title, String target) {
return createLink(new DocLink(path), label, strong, stylename, title, target);
return createLink(new DocLink(path), label, strong, title, target);
}
/**
@ -254,22 +253,16 @@ public class Links {
* @param link the details for the link
* @param label the content for the link
* @param strong whether to wrap the {@code label} in a SPAN element
* @param stylename (deprecated)
* @param title the title for the link
* @param target the target for the link, or null
* @return a content tree for the link
*/
public static Content createLink(DocLink link, Content label, boolean strong, String stylename,
public static Content createLink(DocLink link, Content label, boolean strong,
String title, String target) {
Content body = label;
if (strong) {
body = HtmlTree.SPAN(HtmlStyle.typeNameLink, body);
}
if (stylename != null && stylename.length() != 0) {
HtmlTree t = new HtmlTree(HtmlTag.FONT, body);
t.addAttr(HtmlAttr.CLASS, stylename);
body = t;
}
HtmlTree l = HtmlTree.A(link.toString(), body);
if (title != null && title.length() != 0) {
l.addAttr(HtmlAttr.TITLE, title);