void (@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.methodsHaveSameReturnTypes(method, superMethod) || !AbstractMethodOverridesAbstractMethodInspection.haveSameExceptionSignatures(method, superMethod) || (method.getDocComment() != null && !AbstractMethodOverridesAbstractMethodInspection.haveSameJavaDoc(method, superMethod)) || method.isVarArgs() != superMethod.isVarArgs()) { return; } if (isSuperCallWithSameArguments(body, method, superMethod)) { if (ignoreDelegates) return; registerMethodError(method, Boolean.TRUE); return; } if (checkLibraryMethods && superMethod instanceof PsiCompiledElement) { final PsiElement navigationElement = superMethod.getNavigationElement(); if (!(navigationElement instanceof PsiMethod)) { return; } superMethod = (PsiMethod)navigationElement; } if (superMethod.hasModifierProperty(PsiModifier.DEFAULT) && !HighlightingFeature.EXTENSION_METHODS.isAvailable(method)) { return; } 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 == ClassUtils.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, Boolean.FALSE); } }