Docs generated by Java8 Javadoc are incompatible with "javadoc -source 8"

Roman Marchenko rmarchenko at azul.com
Fri Dec 2 13:49:41 UTC 2022


I tried to investigate JDK-8297437 issue with Javadoc by myself, and I’ve found that Javadoc8 generates some links to constant-values and serialized-forms incorrectly.

I’m not completely sure that this is critical, but I believe that the possible fix for JDK-8297437 will discover this problem, because JDK17 and later have additional test checks for generated anchors, unlike JDK8.

Here is the JDK8 patch to discover the problem with Javadoc8:
---------------------

diff --git a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
index 9e9a15e9d7..3743800ad8 100644
--- a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
@@ -222,6 +222,13 @@ public class TestAnchorNames extends JavadocTester {
         {BUG_ID + FS + "constant-values.html",
             "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
         },
+        {BUG_ID + FS + "constant-values.html",
+            "<a name=\"pkg1.RegClass.S_:D:D:D:D:DINT\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../constant-values.html#pkg1.RegClass.S_:D:D:D:D:DINT\">"
+            // "<a href=\"../constant-values.html#pkg1.RegClass.S_$$$$$INT\">" // this is the current (wrong) link
+        },

         //Test serialized form page

@@ -229,6 +236,13 @@ public class TestAnchorNames extends JavadocTester {
         {BUG_ID + FS + "serialized-form.html",
             "<a name=\"pkg1.RegClass\">"
         },
+        {BUG_ID + FS + "serialized-form.html",
+            "<a name=\"pkg1.RegClass._NestedClas:D\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
+            "<a href=\"../serialized-form.html#pkg1.RegClass._NestedClas:D\">"
+            // "<a href=\"../serialized-form.html#pkg1.RegClass._NestedClas$\">" // this is the current (wrong) link
+        },

         //Test member name index page

diff --git a/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java b/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java
index 60aae773eb..74fb477978 100644
--- a/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java
@@ -172,7 +172,7 @@ public class RegClass implements Serializable {
     /**
      * A nested class.
      */
-    public class _NestedClas$ {}
+    public class _NestedClas$ implements Serializable {}

     /**
      * Nested class D.

---------------------
Best regards,
Roman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/javadoc-dev/attachments/20221202/e51da72e/attachment-0001.htm>


More information about the javadoc-dev mailing list