@Override
    public void visitMethod(@NotNull PsiMethod method) {
      super.visitMethod(method);
      if (method.isConstructor()) {
        return;
      }
      final PsiCodeBlock body = method.getBody();
      if (body == null || method.getNameIdentifier() == null) {
        return;
      }
      PsiMethod superMethod = findSuperMethod(method);
      if (superMethod == null ||
          !AbstractMethodOverridesAbstractMethodInspection.methodsHaveSameAnnotationsAndModifiers(method, superMethod) ||
          !AbstractMethodOverridesAbstractMethodInspection.haveSameReturnTypes(method, superMethod) ||
          !AbstractMethodOverridesAbstractMethodInspection.haveSameExceptionSignatures(method, superMethod) ||
          (method.getDocComment() != null && !AbstractMethodOverridesAbstractMethodInspection.haveSameJavaDoc(method, superMethod)) ||
          method.isVarArgs() != superMethod.isVarArgs()) {
        return;
      }
      if (superMethod.hasModifierProperty(PsiModifier.DEFAULT) && !PsiUtil.isAvailable(JavaFeature.EXTENSION_METHODS, method)) {
        return;
      }
      boolean canBeRemoved = AbstractMethodOverridesAbstractMethodInspection.haveSameParameterTypes(method, superMethod);
      boolean isDelegate = isSuperCallWithSameArguments(body, method, superMethod);
      if (isDelegate) {
        if (!ignoreDelegates && canBeRemoved) {
          registerMethodError(method, isDelegate, canBeRemoved);
        }
        return;
      }
      if (checkLibraryMethods && superMethod instanceof PsiCompiledElement) {
        final PsiElement navigationElement = superMethod.getNavigationElement();
        if (!(navigationElement instanceof PsiMethod)) {
          return;
        }
        superMethod = (PsiMethod)navigationElement;
      }
      final PsiCodeBlock superBody = superMethod.getBody();
      final PsiMethod finalSuperMethod = superMethod;
      final TrackingEquivalenceChecker checker = new TrackingEquivalenceChecker() {
        @Override
        protected boolean equivalentDeclarations(PsiElement element1, PsiElement element2) {
          if (super.equivalentDeclarations(element1, element2)) {
            return true;
          }
          return checkLibraryMethods && element1.getNavigationElement().equals(element2.getNavigationElement());
        }

        @Override
        protected PsiClass getQualifierTarget(PsiReferenceExpression ref) {
          PsiClass target = super.getQualifierTarget(ref);
          if (target == method.getContainingClass() && target == PsiUtil.getContainingClass(ref)) {
            return finalSuperMethod.getContainingClass();
          }
          return target;
        }

        @Override
        protected @NotNull Match thisExpressionsMatch(@NotNull PsiThisExpression thisExpression1,
                                                      @NotNull PsiThisExpression thisExpression2) {
          final PsiClass containingClass1 = PsiUtil.resolveClassInClassTypeOnly(thisExpression1.getType());
          final PsiClass containingClass2 = PsiUtil.resolveClassInClassTypeOnly(thisExpression2.getType());
          if (containingClass1 == finalSuperMethod.getContainingClass()) {
            if (containingClass2 == method.getContainingClass()) {
              return EXACT_MATCH;
            }
          }
          else if (containingClass1 == containingClass2) {
            return EXACT_MATCH;
          }
          return EXACT_MISMATCH;
        }
      };
      final PsiParameter[] parameters = method.getParameterList().getParameters();
      final PsiParameter[] superParameters = superMethod.getParameterList().getParameters();
      for (int i = 0; i < parameters.length; i++) {
        checker.markDeclarationsAsEquivalent(parameters[i], superParameters[i]);
      }
      checker.markDeclarationsAsEquivalent(method, superMethod);
      if (checker.codeBlocksAreEquivalent(body, superBody) && haveTheSameComments(method, superMethod)) {
          registerMethodError(method, isDelegate, canBeRemoved);
      }
    }
@Override
    public void visitMethod(@NotNull PsiMethod method)