8202626: javadoc generates broken links to <Unnamed>
authorpmuthuswamy
Wed, 16 Jan 2019 11:15:25 +0530
changeset 53343 07c09e65ca0f
parent 53342 eabbb779d3eb
child 53344 cfc839f28b89
8202626: javadoc generates broken links to <Unnamed> Reviewed-by: jjg
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java
test/langtools/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java
test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java	Tue Jan 15 19:10:40 2019 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java	Wed Jan 16 11:15:25 2019 +0530
@@ -183,7 +183,7 @@
                 .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
         for (String pkgname: usingPackageToUsedClasses.keySet()) {
             PackageElement pkg = utils.elementUtils.getPackageElement(pkgname);
-            Content packageLink = links.createLink(utils.getPackageName(pkg),
+            Content packageLink = links.createLink(getPackageAnchorName(pkg),
                     new StringContent(utils.getPackageName(pkg)));
             Content summary = new ContentBuilder();
             if (pkg != null && !pkg.isUnnamed()) {
@@ -209,9 +209,7 @@
             PackageElement usingPackage = utils.elementUtils.getPackageElement(packageName);
             HtmlTree li = new HtmlTree(HtmlTag.LI);
             li.setStyle(HtmlStyle.blockList);
-            if (usingPackage != null) {
-                li.addContent(links.createAnchor(utils.getPackageName(usingPackage)));
-            }
+            li.addContent(links.createAnchor(getPackageAnchorName(usingPackage)));
             String tableSummary = resources.getText("doclet.Use_Table_Summary",
                                                         resources.getText("doclet.classes"));
             Content caption = contents.getContent(
--- a/test/langtools/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java	Tue Jan 15 19:10:40 2019 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testPackageDeprecation/TestPackageDeprecation.java	Wed Jan 16 11:15:25 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      6492694 8026567 8048351 8162363 8183511 8169819 8074407 8196202
+ * @bug      6492694 8026567 8048351 8162363 8183511 8169819 8074407 8196202 8202626
  * @summary  Test package deprecation.
  * @author   bpatel
  * @library  ../../lib/
@@ -38,7 +38,6 @@
 
     public static void main(String... args) throws Exception {
         TestPackageDeprecation tester = new TestPackageDeprecation();
-        tester.setAutomaticCheckLinks(false); // @ignore JDK-8202626
         tester.runTests();
     }
 
--- a/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java	Tue Jan 15 19:10:40 2019 -0800
+++ b/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java	Wed Jan 16 11:15:25 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, 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
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982 8162363 8175200 8186332
- *      8182765 8196202
+ *      8182765 8196202 8202626
  * @summary A simple test to ensure class-use files are correct.
  * @author jamieh
  * @library ../../lib
@@ -39,7 +39,6 @@
 
     public static void main(String... args) throws Exception {
         TestUseOption tester = new TestUseOption();
-        tester.setAutomaticCheckLinks(false); // @ignore JDK-8202626
         tester.runTests();
     }
 
@@ -201,7 +200,7 @@
         checkOutput("package-use.html", true,
                 "<th class=\"colFirst\" scope=\"row\">"
                 + "<a href=\"class-use/UsedInC.html#unnamed.package\">UsedInC</a></th>",
-                "<th class=\"colFirst\" scope=\"row\"><a href=\"#%3CUnnamed%3E\">&lt;Unnamed&gt;</a></th>\n"
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"#unnamed.package\">&lt;Unnamed&gt;</a></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>"
         );
     }
@@ -219,7 +218,7 @@
                 "<li class=\"blockList\"><a name=\"unnamed.package\">"
         );
         checkOutput("package-use.html", true,
-                "<th class=\"colFirst\" scope=\"row\"><a href=\"#-Unnamed-\">&lt;Unnamed&gt;</a></th>\n"
+                "<th class=\"colFirst\" scope=\"row\"><a href=\"#unnamed.package\">&lt;Unnamed&gt;</a></th>\n"
                 + "<td class=\"colLast\">&nbsp;</td>"
         );
     }