use of com.sun.tools.javac.tree.JCTree.JCCompilationUnit in project bazel by bazelbuild.
the class TreePrunerTest method constructorChaining.
@Test
public void constructorChaining() {
String[] lines = { "class Test {", " Test() {", " this(42);", " process();", " }", " Test() {", " this(42);", " }", " Test() {", " super(42);", " }", " Test() {}", "}" };
JCCompilationUnit tree = parseLines(lines);
TreePruner.prune(context, tree);
String[] expected = { "class Test {", " ", " Test() {", " this(42);", " }", " ", " Test() {", " this(42);", " }", " ", " Test() {", " super(42);", " }", " ", " Test() {", " }", "}" };
assertThat(prettyPrint(tree)).isEqualTo(Joiner.on('\n').join(expected));
}
use of com.sun.tools.javac.tree.JCTree.JCCompilationUnit in project bazel by bazelbuild.
the class TreePrunerTest method initalizerBlocks.
@Test
public void initalizerBlocks() {
String[] lines = { "class Test {", " {", " System.err.println(\"hello\");", " }", " static {", " System.err.println(\"hello\");", " }", "}" };
JCCompilationUnit tree = parseLines(lines);
TreePruner.prune(context, tree);
String[] expected = { //
"class Test {", " {", " }", " static {", " }", "}" };
assertThat(prettyPrint(tree)).isEqualTo(Joiner.on('\n').join(expected));
}
use of com.sun.tools.javac.tree.JCTree.JCCompilationUnit in project lombok by rzwitserloot.
the class CommentCollectingParser method compilationUnit.
@Override
public JCCompilationUnit compilationUnit() {
JCCompilationUnit result = super.compilationUnit();
if (lexer instanceof CommentCollectingScanner) {
List<CommentInfo> comments = ((CommentCollectingScanner) lexer).getComments();
JCCompilationUnit_comments.set(result, comments);
}
return result;
}
use of com.sun.tools.javac.tree.JCTree.JCCompilationUnit in project lombok by rzwitserloot.
the class CommentCollectingParser method parseCompilationUnit.
public JCCompilationUnit parseCompilationUnit() {
JCCompilationUnit result = super.parseCompilationUnit();
if (lexer instanceof CommentCollectingScanner) {
List<CommentInfo> comments = ((CommentCollectingScanner) lexer).getComments();
JCCompilationUnit_comments.set(result, comments);
}
return result;
}
use of com.sun.tools.javac.tree.JCTree.JCCompilationUnit in project lombok by rzwitserloot.
the class CommentCollectingParser method parseCompilationUnit.
public JCCompilationUnit parseCompilationUnit() {
JCCompilationUnit result = super.parseCompilationUnit();
if (lexer instanceof CommentCollectingScanner) {
List<CommentInfo> comments = ((CommentCollectingScanner) lexer).getComments();
JCCompilationUnit_comments.set(result, comments);
}
return result;
}
Aggregations