--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java Mon Sep 09 11:43:16 2019 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java Wed Nov 27 09:00:01 2019 +0100
@@ -234,6 +234,14 @@
printExprs(trees, ", ");
}
+
+ /** Derived visitor method: print pattern.
+ */
+
+ public void printPattern(JCTree tree) throws IOException {
+ printExpr(tree);
+ }
+
/** Derived visitor method: print list of statements, each on a separate line.
*/
public void printStats(List<? extends JCTree> trees) throws IOException {
@@ -877,6 +885,16 @@
}
}
+ public void visitBindingPattern(JCBindingPattern patt) {
+ try {
+ printExpr(patt.vartype);
+ print(" ");
+ print(patt.name);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
public void visitSynchronized(JCSynchronized tree) {
try {
print("synchronized ");
@@ -1283,7 +1301,11 @@
open(prec, TreeInfo.ordPrec);
printExpr(tree.expr, TreeInfo.ordPrec);
print(" instanceof ");
- printExpr(tree.clazz, TreeInfo.ordPrec + 1);
+ if (tree.pattern instanceof JCPattern) {
+ printPattern(tree.pattern);
+ } else {
+ printExpr(tree.getType(), TreeInfo.ordPrec + 1);
+ }
close(prec, TreeInfo.ordPrec);
} catch (IOException e) {
throw new UncheckedIOException(e);