void (@NotNull PsiModifierList list) { super.visitModifierList(list); PsiElement parent = list.getParent(); if (parent instanceof PsiMethod method) { if (!hasErrorResults()) add(HighlightMethodUtil.checkMethodCanHaveBody(method, myLanguageLevel)); MethodSignatureBackedByPsiMethod methodSignature = MethodSignatureBackedByPsiMethod.create(method, PsiSubstitutor.EMPTY); PsiClass aClass = method.getContainingClass(); if (!method.isConstructor()) { try { List<HierarchicalMethodSignature> superMethodSignatures = method.getHierarchicalMethodSignature().getSuperSignatures(); if (!superMethodSignatures.isEmpty()) { if (!method.hasModifierProperty(PsiModifier.STATIC)) { if (!hasErrorResults()) { add(HighlightMethodUtil.checkMethodWeakerPrivileges(methodSignature, superMethodSignatures, true, myFile, null)); } if (!hasErrorResults()) add(HighlightMethodUtil.checkMethodOverridesFinal(methodSignature, superMethodSignatures)); } if (!hasErrorResults()) { add(HighlightMethodUtil.checkMethodIncompatibleReturnType(methodSignature, superMethodSignatures, true, null)); } if (aClass != null && !hasErrorResults()) { add(HighlightMethodUtil.checkMethodIncompatibleThrows(methodSignature, superMethodSignatures, true, aClass, null)); } } } catch (IndexNotReadyException ignored) { } } if (!hasErrorResults()) add(HighlightMethodUtil.checkMethodMustHaveBody(method, aClass)); if (!hasErrorResults()) { add( HighlightMethodUtil.checkConstructorCallsBaseClassConstructor(method, myRefCountHolder, getResolveHelper(getProject()))); } if (!hasErrorResults()) add(HighlightMethodUtil.checkStaticMethodOverride(method, myFile)); if (!hasErrorResults() && aClass != null && myOverrideEquivalentMethodsVisitedClasses.add(aClass)) { GenericsHighlightUtil.checkOverrideEquivalentMethods(aClass, false, myErrorSink); } } else if (parent instanceof PsiClass aClass) { try { if (!hasErrorResults()) add(HighlightClassUtil.checkDuplicateNestedClass(aClass)); if (!hasErrorResults()) { TextRange textRange = HighlightNamesUtil.getClassDeclarationTextRange(aClass); add(HighlightClassUtil.checkClassMustBeAbstract(aClass, textRange)); } if (!hasErrorResults()) { add(HighlightClassUtil.checkClassDoesNotCallSuperConstructorOrHandleExceptions(aClass, myRefCountHolder, getResolveHelper(getProject()))); } if (!hasErrorResults()) add(HighlightMethodUtil.checkOverrideEquivalentInheritedMethods(aClass, myFile, myLanguageLevel)); if (!hasErrorResults() && myOverrideEquivalentMethodsVisitedClasses.add(aClass)) { GenericsHighlightUtil.checkOverrideEquivalentMethods(aClass, false, myErrorSink); } if (!hasErrorResults()) add(HighlightClassUtil.checkCyclicInheritance(aClass)); } catch (IndexNotReadyException ignored) { } } }