PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(@NotNull PsiElement element) { if (element instanceof GrVariableDeclaration decl) { GrVariable[] variables = decl.getVariables(); return variables.length > 1 && PsiUtil.isLocalVariable(variables[0]) || variables.length == 1 && PsiUtil.isLocalVariable(variables[0]) && variables[0].getInitializerGroovy() != null; } return false; } }; }