String (final PsiClass psiClass, final LookupElement item, boolean diamond, @NotNull PsiSubstitutor substitutor) { String forced = item instanceof JavaPsiClassReferenceElement ? ((JavaPsiClassReferenceElement)item).getForcedPresentableName() : item instanceof PsiTypeLookupItem ? ((PsiTypeLookupItem)item).getForcedPresentableName() : null; if (forced != null) { return forced; } String name = PsiUtilCore.getName(psiClass); if (diamond) { return name + "<>"; } if (substitutor != PsiSubstitutor.EMPTY) { final PsiTypeParameter[] params = psiClass.getTypeParameters(); if (params.length > 0) { return name + formatTypeParameters(substitutor, params); } } return StringUtil.notNullize(name); }