String (@NotNull PsiType type) { type = type.getDeepComponentType(); if (type instanceof PsiClassType classType) { final String className = classType.getClassName(); if (className != null) return className; final PsiClass aClass = classType.resolve(); return aClass instanceof PsiAnonymousClass ? ((PsiAnonymousClass)aClass).getBaseClassType().getClassName() : null; } else if (type instanceof PsiPrimitiveType) { return type.getPresentableText(); } else if (type instanceof PsiWildcardType) { return getTypeName(((PsiWildcardType)type).getExtendsBound()); } else if (type instanceof PsiIntersectionType) { return getTypeName(((PsiIntersectionType)type).getRepresentative()); } else if (type instanceof PsiCapturedWildcardType) { return getTypeName(((PsiCapturedWildcardType)type).getWildcard()); } else if (type instanceof PsiDisjunctionType) { return getTypeName(((PsiDisjunctionType)type).getLeastUpperBound()); } else { return null; } }