8230516: invalid html in jdwp-protocol.html
authoramenkov
Mon, 09 Sep 2019 12:00:36 -0700
changeset 58057 f894baf8d871
parent 58056 db92a157dd70
child 58058 b553ad95acf0
8230516: invalid html in jdwp-protocol.html Reviewed-by: dtitov, sspitsyn
make/jdk/src/classes/build/tools/jdwpgen/ConstantNode.java
make/jdk/src/classes/build/tools/jdwpgen/ConstantSetNode.java
--- a/make/jdk/src/classes/build/tools/jdwpgen/ConstantNode.java	Mon Sep 09 11:04:04 2019 -0700
+++ b/make/jdk/src/classes/build/tools/jdwpgen/ConstantNode.java	Mon Sep 09 12:00:36 2019 -0700
@@ -55,8 +55,14 @@
 
     void document(PrintWriter writer) {
         //Add anchor to each constant with format <constant table name>_<constant name>
+        if (!(parent instanceof AbstractNamedNode)) {
+            error("Parent must be ConstantSetNode, but it's " + parent.getClass().getSimpleName());
+        }
+        String tableName = ((AbstractNamedNode)parent).name;
         writer.println("<tr>"
-                        + "<th scope=\"row\">" + name
+                        + "<th scope=\"row\">"
+                            + "<span id=\"" + tableName + "_" + name + "\"></span>"
+                            + name
                         + "<td class=\"centered\">" + nameNode.value()
                         + "<td>" + comment() + "&nbsp;"
                     + "</tr>");
--- a/make/jdk/src/classes/build/tools/jdwpgen/ConstantSetNode.java	Mon Sep 09 11:04:04 2019 -0700
+++ b/make/jdk/src/classes/build/tools/jdwpgen/ConstantSetNode.java	Mon Sep 09 12:00:36 2019 -0700
@@ -62,9 +62,7 @@
         writer.println("<th class=\"bold\" style=\"width: 65%\" scope=\"col\">Description");
         writer.println("</tr>");
         for (Node node : components) {
-            ConstantNode n = (ConstantNode)node;
-            writer.println("<span id=\"" + name + "_" + n.name + "\"></span>");
-            n.document(writer);
+            node.document(writer);
         }
         writer.println("</table>");
     }