void (@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); final PsiReferenceExpression methodExpression = expression.getMethodExpression(); final PsiExpression qualifier = methodExpression.getQualifierExpression(); if (qualifier != null) { return; } PsiClass containingClass = ClassUtils.getContainingClass(expression); if (containingClass == null) { return; } final PsiMethod targetMethod = expression.resolveMethod(); if (targetMethod == null) { return; } final PsiClass methodClass = targetMethod.getContainingClass(); if (methodClass == null || !containingClass.isInheritor(methodClass, true)) { return; } boolean staticAccess = containingClass.hasModifierProperty(PsiModifier.STATIC); containingClass = ClassUtils.getContainingClass(containingClass); while (containingClass != null) { staticAccess |= containingClass.hasModifierProperty(PsiModifier.STATIC); final PsiMethod[] methods = containingClass.findMethodsBySignature(targetMethod, false); if (methods.length > 0 && !methodClass.equals(containingClass)) { if (!staticAccess || ContainerUtil.exists(methods, m -> m.hasModifierProperty(PsiModifier.STATIC))) { registerMethodCallError(expression, methodClass, containingClass); return; } } containingClass = ClassUtils.getContainingClass(containingClass); } }