RFR [16] 8252172: Improve prettiness of printing HTML attributes by DocPretty

Pavel Rappo pavel.rappo at oracle.com
Fri Aug 28 09:31:53 UTC 2020


Hello,

Please review the below change for https://bugs.openjdk.java.net/browse/JDK-8252172

  http://cr.openjdk.java.net/~prappo/8252172/webrev.00/

The crux of the change is this:

@@ -497,7 +492,7 @@ public class DocPretty implements DocTreeVisitor<Void,Void> {
             List<? extends DocTree> attrs = node.getAttributes();
             if (!attrs.isEmpty()) {
                 print(" ");
-                print(attrs);
+                print(attrs, " ");
                 DocTree last = node.getAttributes().get(attrs.size() - 1);
                 if (node.isSelfClosing() && last instanceof AttributeTree
                         && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)

That fixes printing out HTML attributes, which were otherwise squeezed together: for example, a=b c=d e=f was printed out as a=bc=de=f.
The rest of the change consists of a test for that and some opportunistic cleanup.

Thanks,
-Pavel



More information about the compiler-dev mailing list