src/share/classes/com/sun/tools/javac/tree/Pretty.java

Print this page




 674     public void visitSynchronized(JCSynchronized tree) {
 675         try {
 676             print("synchronized ");
 677             if (tree.lock.getTag() == JCTree.PARENS) {
 678                 printExpr(tree.lock);
 679             } else {
 680                 print("(");
 681                 printExpr(tree.lock);
 682                 print(")");
 683             }
 684             print(" ");
 685             printStat(tree.body);
 686         } catch (IOException e) {
 687             throw new UncheckedIOException(e);
 688         }
 689     }
 690 
 691     public void visitTry(JCTry tree) {
 692         try {
 693             print("try ");













 694             printStat(tree.body);
 695             for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
 696                 printStat(l.head);
 697             }
 698             if (tree.finalizer != null) {
 699                 print(" finally ");
 700                 printStat(tree.finalizer);
 701             }
 702         } catch (IOException e) {
 703             throw new UncheckedIOException(e);
 704         }
 705     }
 706 
 707     public void visitCatch(JCCatch tree) {
 708         try {
 709             print(" catch (");
 710             printExpr(tree.param);
 711             print(") ");
 712             printStat(tree.body);
 713         } catch (IOException e) {




 674     public void visitSynchronized(JCSynchronized tree) {
 675         try {
 676             print("synchronized ");
 677             if (tree.lock.getTag() == JCTree.PARENS) {
 678                 printExpr(tree.lock);
 679             } else {
 680                 print("(");
 681                 printExpr(tree.lock);
 682                 print(")");
 683             }
 684             print(" ");
 685             printStat(tree.body);
 686         } catch (IOException e) {
 687             throw new UncheckedIOException(e);
 688         }
 689     }
 690 
 691     public void visitTry(JCTry tree) {
 692         try {
 693             print("try ");
 694             if (tree.resources.nonEmpty()) {
 695                 print("(");
 696                 boolean first = true;
 697                 for (JCTree var : tree.resources) {
 698                     if (!first) {
 699                         println();
 700                         indent();
 701                     }
 702                     printStat(var);
 703                     first = false;
 704                 }
 705                 print(") ");
 706             }
 707             printStat(tree.body);
 708             for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
 709                 printStat(l.head);
 710             }
 711             if (tree.finalizer != null) {
 712                 print(" finally ");
 713                 printStat(tree.finalizer);
 714             }
 715         } catch (IOException e) {
 716             throw new UncheckedIOException(e);
 717         }
 718     }
 719 
 720     public void visitCatch(JCCatch tree) {
 721         try {
 722             print(" catch (");
 723             printExpr(tree.param);
 724             print(") ");
 725             printStat(tree.body);
 726         } catch (IOException e) {