LinkedHashSet<String> (GrVariable var, GrExpression expr, StringPartInfo stringPart, GrParameterListOwner scope, Project project) { if (expr != null) { final GrIntroduceContext introduceContext = new GrIntroduceContextImpl(project, null, expr, var, stringPart, PsiElement.EMPTY_ARRAY, scope); final GroovyFieldValidator validator = new GroovyFieldValidator(introduceContext); return new LinkedHashSet<>(Arrays.asList(GroovyNameSuggestionUtil.suggestVariableNames(expr, validator, true))); } else if (var != null) { final GrIntroduceContext introduceContext = new GrIntroduceContextImpl(project, null, expr, var, stringPart, PsiElement.EMPTY_ARRAY, scope); final GroovyFieldValidator validator = new GroovyFieldValidator(introduceContext); LinkedHashSet<String> names = new LinkedHashSet<>(); names.add(var.getName()); ContainerUtil.addAll(names, GroovyNameSuggestionUtil.suggestVariableNameByType(var.getType(), validator)); return names; } else { LinkedHashSet<String> names = new LinkedHashSet<>(); names.add("closure"); return names; } }