void (@NotNull PsiClass aClass, Object... infos) { final PsiElement nameIdentifier; if (aClass instanceof PsiEnumConstantInitializer enumConstantInitializer) { final PsiEnumConstant enumConstant = enumConstantInitializer.getEnumConstant(); nameIdentifier = enumConstant.getNameIdentifier(); } else if (aClass instanceof PsiAnonymousClass anonymousClass) { nameIdentifier = anonymousClass.getBaseClassReference(); } else { nameIdentifier = aClass.getNameIdentifier(); } if (nameIdentifier == null) { return; } if (!nameIdentifier.isPhysical()) { registerError(nameIdentifier.getNavigationElement(), infos); return; } registerError(nameIdentifier, infos); }