void (@NotNull PsiIdentifier identifier) { PsiElement parent = identifier.getParent(); if (parent instanceof PsiVariable variable) { add(HighlightUtil.checkVariableAlreadyDefined(variable)); if (variable.isUnnamed()) { HighlightInfo.Builder notAvailable = checkFeature(variable, HighlightingFeature.UNNAMED_PATTERNS_AND_VARIABLES); if (notAvailable != null) { add(notAvailable); } else { add(HighlightUtil.checkUnnamedVariableDeclaration(variable)); } } if (variable.getInitializer() == null) { PsiElement child = variable.getLastChild(); if (child instanceof PsiErrorElement && child.getPrevSibling() == identifier) return; } } else if (parent instanceof PsiClass aClass) { if (aClass.isAnnotationType()) { add(checkFeature(identifier, HighlightingFeature.ANNOTATIONS)); } add(HighlightClassUtil.checkClassAlreadyImported(aClass, identifier)); if (!hasErrorResults()) { add(HighlightClassUtil.checkClassRestrictedKeyword(myLanguageLevel, identifier)); } if (!hasErrorResults() && myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) { add(GenericsHighlightUtil.checkUnrelatedDefaultMethods(aClass, identifier)); } if (!hasErrorResults()) { add(GenericsHighlightUtil.checkUnrelatedConcrete(aClass, identifier)); } } else if (parent instanceof PsiMethod method) { if (method.isConstructor()) { HighlightInfo.Builder info = HighlightMethodUtil.checkConstructorName(method); if (info != null) { PsiType expectedType = myExpectedReturnTypes.computeIfAbsent(method, HighlightMethodUtil::determineReturnType); if (expectedType != null) { HighlightUtil.registerReturnTypeFixes(info, method, expectedType); } } add(info); } PsiClass aClass = method.getContainingClass(); if (aClass != null) { add(GenericsHighlightUtil.checkDefaultMethodOverridesMemberOfJavaLangObject(myLanguageLevel, aClass, method, identifier)); } } add(HighlightUtil.checkUnderscore(identifier, myLanguageLevel)); super.visitIdentifier(identifier); }