8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation

Reviewed-by: jjg
This commit is contained in:
Bhavesh Patel 2014-09-26 13:51:43 -07:00
parent 50228a4342
commit 3fad9f6677
5 changed files with 24 additions and 9 deletions

View File

@ -333,7 +333,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
for (PackageDoc pkg : pkgSet) {
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(getPackageAnchorName(pkg)));
Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
classdoc)),
@ -355,7 +355,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
*/
protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
getHyperLink(pkg.name(), new StringContent(utils.getPackageName(pkg))));
getHyperLink(getPackageAnchorName(pkg), new StringContent(utils.getPackageName(pkg))));
contentTree.addContent(tdFirst);
HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
tdLast.addStyle(HtmlStyle.colLast);

View File

@ -991,6 +991,16 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return pathToRoot.resolve(DocPath.forPackage(pd).resolve(name));
}
/**
* Given a package, return the name to be used in HTML anchor tag.
* @param packageDoc the package.
* @return the name to be used in HTML anchor tag.
*/
public String getPackageAnchorName(PackageDoc packageDoc) {
return packageDoc == null || packageDoc.name().length() == 0 ?
SectionName.UNNAMED_PACKAGE_ANCHOR.getName() : packageDoc.name();
}
/**
* Return the link to the given package.
*

View File

@ -207,7 +207,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
} else {
tr.addStyle(HtmlStyle.rowColor);
}
addClassRow(itc.next(), packageName, tr);
addClassRow(itc.next(), usingPackage, tr);
tbody.addContent(tr);
}
table.addContent(tbody);
@ -220,15 +220,15 @@ public class PackageUseWriter extends SubWriterHolderWriter {
* Add a row for the class that uses the given package.
*
* @param usedClass the class that uses the given package
* @param packageName the name of the package to which the class belongs
* @param pkg the package to which the class belongs
* @param contentTree the content tree to which the row will be added
*/
protected void addClassRow(ClassDoc usedClass, String packageName,
protected void addClassRow(ClassDoc usedClass, PackageDoc pkg,
Content contentTree) {
DocPath dp = pathString(usedClass,
DocPaths.CLASS_USE.resolve(DocPath.forName(usedClass)));
Content td = HtmlTree.TD(HtmlStyle.colOne,
getHyperLink(dp.fragment(packageName), new StringContent(usedClass.name())));
getHyperLink(dp.fragment(getPackageAnchorName(pkg)), new StringContent(usedClass.name())));
addIndexComment(usedClass, td);
contentTree.addContent(td);
}

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 6492694 8026567
* @bug 6492694 8026567 8048351
* @summary Test package deprecation.
* @author bpatel
* @library ../lib/
@ -70,6 +70,8 @@ public class TestPackageDeprecation extends JavadocTester {
"pkg1");
checkOutput("allclasses-frame.html", false,
"FooDepr");
checkOutput("class-use/C2.ModalExclusionType.html", true,
"<td class=\"colFirst\"><a href=\"#unnamed.package\">&lt;Unnamed&gt;</a></td>");
checkFiles(false,
"pkg1/package-summary.html",

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 4496290 4985072 7006178 7068595 8016328 8050031
* @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351
* @summary A simple test to ensure class-use files are correct.
* @author jamieh
* @library ../lib
@ -134,9 +134,12 @@ public class TestUseOption extends JavadocTester {
"Uses of <a href=\"../UsedInC.html\" title=\"class in &lt;Unnamed&gt;\">"
+ "UsedInC</a> in <a href=\"../package-summary.html\">&lt;Unnamed&gt;</a>"
);
checkOutput("class-use/UsedInC.html", true,
"<li class=\"blockList\"><a name=\"unnamed.package\">"
);
checkOutput("package-use.html", true,
"<td class=\"colOne\">"
+ "<a href=\"class-use/UsedInC.html#%3CUnnamed%3E\">UsedInC</a>&nbsp;</td>"
+ "<a href=\"class-use/UsedInC.html#unnamed.package\">UsedInC</a>&nbsp;</td>"
);
}