@Test void testVariableWithInitializer() { MethodTree tree = buildSyntaxTree("public void test() {int i = length;}"); assertThat(SyntaxTreeNameFinder.getName(tree)).isEqualTo("length"); }
public static String getName(Tree syntaxNode) { SyntaxTreeNameFinder finder = new SyntaxTreeNameFinder(); syntaxNode.accept(finder); return finder.getName(); }
SyntaxTreeNameFinder extends BaseTreeVisitor { public static String getName(Tree syntaxNode) { SyntaxTreeNameFinder finder = new SyntaxTreeNameFinder(); syntaxNode.accept(finder); return finder.getName(); } }
SyntaxTreeNameFinder extends BaseTreeVisitor { public static String getName(Tree syntaxNode) { SyntaxTreeNameFinder finder = new SyntaxTreeNameFinder(); syntaxNode.accept(finder); return finder.getName(); }  }
SyntaxTreeNameFinder extends BaseTreeVisitor { public static String getName(Tree syntaxNode) { SyntaxTreeNameFinder finder = new SyntaxTreeNameFinder(); syntaxNode.accept(finder); return finder.getName(); }  static String getName(Tree syntaxNode); @Override void visitIdentifier(IdentifierTree tree); @Override void visitMemberSelectExpression(MemberSelectExpressionTree tree); @Override void visitSwitchStatement(SwitchStatementTree tree); @Override void visitParenthesized(ParenthesizedTree tree); @Override void visitTypeCast(TypeCastTree tree); @Override void visitMethodInvocation(MethodInvocationTree tree); @Override void visitVariable(VariableTree tree); }
SyntaxTreeNameFinder extends BaseTreeVisitor { public static String getName(Tree syntaxNode) { SyntaxTreeNameFinder finder = new SyntaxTreeNameFinder(); syntaxNode.accept(finder); return finder.getName(); }  static String getName(Tree syntaxNode); @Override void visitIdentifier(IdentifierTree tree); @Override void visitMemberSelectExpression(MemberSelectExpressionTree tree); @Override void visitSwitchStatement(SwitchStatementTree tree); @Override void visitParenthesized(ParenthesizedTree tree); @Override void visitTypeCast(TypeCastTree tree); @Override void visitMethodInvocation(MethodInvocationTree tree); @Override void visitVariable(VariableTree tree);  }