String[] (PsiClass anonOrLocalClass) { String className = anonOrLocalClass.getName(); if (className != null) { return new String[]{className}; } if (!(anonOrLocalClass instanceof PsiAnonymousClass anonymousClass)) { return new String[]{"MyClass"}; } String name = anonymousClass.getBaseClassReference().getReferenceName(); PsiType[] typeParameters = anonymousClass.getBaseClassReference().getTypeParameters(); final String typeParamsList = StringUtil.join(typeParameters, psiType -> { PsiType type = psiType; if (psiType instanceof PsiClassType) { type = TypeConversionUtil.erasure(psiType); } if (type == null || type.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) return ""; if (type instanceof PsiArrayType) { type = type.getDeepComponentType(); } return StringUtil.getShortName(type.getPresentableText()); }, "") + name; return !typeParamsList.equals(name) ? new String[]{typeParamsList, "My" + name} : new String[]{"My" + name}; }