String (@NotNull PsiElement element) { String result; if (element instanceof PsiClass) { result = ((PsiClass)element).getQualifiedName(); if (result == null) result = element.getText(); } else if (element instanceof PsiJavaCodeReferenceElement) { result = ((PsiJavaCodeReferenceElement)element).getCanonicalText(); } else if (element instanceof PsiTypeElement typeElement) { result = typeElement.isInferredType() ? typeElement.getText() : typeElement.getType().getCanonicalText(); } else { result = element.getText(); } final int index = result.indexOf('<'); return index == -1 ? result : result.substring(0, index); }