/** Returns a {@code String} representation of a statement, including semicolon. */ private static String printStatement(Context context, JCStatement statement) { StringWriter writer = new StringWriter(); try { pretty(context, writer).printStat(statement); } catch (IOException e) { throw new AssertionError("StringWriter cannot throw IOExceptions"); } return writer.toString(); }
@Override public void printStat(JCTree tree) throws IOException { if (tree instanceof JCExpressionStatement && ((JCExpressionStatement) tree).getExpression() instanceof JCMethodInvocation) { JCMethodInvocation invocation = (JCMethodInvocation) ((JCExpressionStatement) tree).getExpression(); JCExpression select = invocation.getMethodSelect(); if (select != null && select.toString().equals("Refaster.emitComment")) { String commentLiteral = (String) ((JCLiteral) invocation.getArguments().get(0)).getValue(); print("// " + commentLiteral); return; } } super.printStat(tree); }
/** Returns a {@code String} representation of a statement, including semicolon. */ private static String printStatement(Context context, JCStatement statement) { StringWriter writer = new StringWriter(); try { pretty(context, writer).printStat(statement); } catch (IOException e) { throw new AssertionError("StringWriter cannot throw IOExceptions"); } return writer.toString(); }
public void visitLabelled(JCLabeledStatement tree) { try { print(tree.label + ": "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void visitLabelled(JCLabeledStatement tree) { try { print(tree.label + ": "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void visitLabelled(JCLabeledStatement tree) { try { print(tree.label + ": "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void visitLabelled(JCLabeledStatement tree) { try { print(tree.label + ": "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
/** Derived visitor method: print list of statements, each on a separate line. */ public void printStats(List<? extends JCTree> trees) throws IOException { for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail) { align(); printStat(l.head); println(); } }
public void printAnnotations(List<JCAnnotation> trees) throws IOException { for (List<JCAnnotation> l = trees; l.nonEmpty(); l = l.tail) { printStat(l.head); println(); align(); } }
/** Derived visitor method: print list of statements, each on a separate line. */ public void printStats(List<? extends JCTree> trees) throws IOException { for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail) { align(); printStat(l.head); println(); } }
public void printAnnotations(List<JCAnnotation> trees) throws IOException { for (List<JCAnnotation> l = trees; l.nonEmpty(); l = l.tail) { printStat(l.head); println(); align(); } }
public void printAnnotations(List<JCAnnotation> trees) throws IOException { for (List<JCAnnotation> l = trees; l.nonEmpty(); l = l.tail) { printStat(l.head); println(); align(); } }
public void printAnnotations(List<JCAnnotation> trees) throws IOException { for (List<JCAnnotation> l = trees; l.nonEmpty(); l = l.tail) { printStat(l.head); println(); align(); } }
/** Derived visitor method: print list of statements, each on a separate line. */ public void printStats(List<? extends JCTree> trees) throws IOException { for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail) { align(); printStat(l.head); println(); } }
public void visitCatch(JCCatch tree) { try { print(" catch ("); printExpr(tree.param); print(") "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void visitCatch(JCCatch tree) { try { print(" catch ("); printExpr(tree.param); print(") "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void visitCatch(JCCatch tree) { try { print(" catch ("); printExpr(tree.param); print(") "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void visitForeachLoop(JCEnhancedForLoop tree) { try { print("for ("); printExpr(tree.var); print(" : "); printExpr(tree.expr); print(") "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void visitForeachLoop(JCEnhancedForLoop tree) { try { print("for ("); printExpr(tree.var); print(" : "); printExpr(tree.expr); print(") "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void visitForeachLoop(JCEnhancedForLoop tree) { try { print("for ("); printExpr(tree.var); print(" : "); printExpr(tree.expr); print(") "); printStat(tree.body); } catch (IOException e) { throw new UncheckedIOException(e); } }