SuggestedNameInfo (final PsiElement element, final PsiElement nameSuggestionContext, Set<String> result) { if (!element.getLanguage().isKindOf(JavaLanguage.INSTANCE)) return null; String initialName = UsageViewUtil.getShortName(element); SuggestedNameInfo info = suggestNamesForElement(element, nameSuggestionContext); if (info != null) { info = JavaCodeStyleManager.getInstance(element.getProject()).suggestUniqueVariableName(info, element, true, true); } String parameterName = null; String superMethodName = null; if (nameSuggestionContext instanceof PsiParameter) { final PsiElement nameSuggestionContextParent = nameSuggestionContext.getParent(); if (nameSuggestionContextParent instanceof PsiParameterList) { final PsiElement parentOfParent = nameSuggestionContextParent.getParent(); if (parentOfParent instanceof PsiMethod) { final String propName = PropertyUtilBase.getPropertyName((PsiMethod)parentOfParent); if (propName != null) { parameterName = propName; } superMethodName = getSuperMethodName((PsiParameter) nameSuggestionContext, (PsiMethod) parentOfParent); } } } final String[] strings = info != null ? info.names : ArrayUtilRt.EMPTY_STRING_ARRAY; final ArrayList<String> list = new ArrayList<>(Arrays.asList(strings)); final String[] properlyCased = suggestProperlyCasedName(element); if (properlyCased != null) { Collections.addAll(list, properlyCased); } if (parameterName != null && !list.contains(parameterName)) { list.add(parameterName); } if (superMethodName != null && !list.contains(superMethodName)) { list.add(0, superMethodName); } list.remove(initialName); list.add(initialName); ContainerUtil.removeDuplicates(list); result.addAll(list); return info; }