@Override
  public void visitModifierList(@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, getResolveHelper(getProject())));
      }
      if (!hasErrorResults()) add(HighlightMethodUtil.checkStaticMethodOverride(method, myFile));
      if (!hasErrorResults() && aClass != null) {
        GenericsHighlightUtil.computeOverrideEquivalentMethodErrors(aClass, myOverrideEquivalentMethodsVisitedClasses, myOverrideEquivalentMethodsErrors);
        myErrorSink.accept(myOverrideEquivalentMethodsErrors.get(method));
      }
    }
    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, getResolveHelper(getProject())));
        }
        if (!hasErrorResults()) add(HighlightMethodUtil.checkOverrideEquivalentInheritedMethods(aClass, myFile, myLanguageLevel));
        if (!hasErrorResults()) {
          GenericsHighlightUtil.computeOverrideEquivalentMethodErrors(aClass, myOverrideEquivalentMethodsVisitedClasses, myOverrideEquivalentMethodsErrors);
          myErrorSink.accept(myOverrideEquivalentMethodsErrors.get(aClass));
        }
        if (!hasErrorResults()) add(HighlightClassUtil.checkCyclicInheritance(aClass));
      }
      catch (IndexNotReadyException ignored) {
      }
    }
  }
@Override
  public void visitModifierList(@NotNull PsiModifierList list)