void (final String newName, GroovyPsiElement place, final CollidingVariableVisitor visitor) { place.accept(new GroovyRecursiveElementVisitor() { @Override public void visitVariableDeclaration(@NotNull GrVariableDeclaration variableDeclaration) { final GrVariable[] variables = variableDeclaration.getVariables(); for (GrVariable variable : variables) { if (variable.getName().equals(newName)) { visitor.visitCollidingVariable(variable); } } } @Override public void visitMethod(@NotNull GrMethod method) {} @Override public void visitClosure(@NotNull GrClosableBlock closure) {} @Override public void visitTypeDefinition(@NotNull GrTypeDefinition typeDefinition) {} }); }