changeset 56218:f894baf8d871

8230516: invalid html in jdwp-protocol.html Reviewed-by: dtitov, sspitsyn
author amenkov
date Mon, 09 Sep 2019 12:00:36 -0700
parents db92a157dd70
children b553ad95acf0
files make/jdk/src/classes/build/tools/jdwpgen/ConstantNode.java make/jdk/src/classes/build/tools/jdwpgen/ConstantSetNode.java
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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>");
     }