void (@NotNull PsiMethodCallExpression call) { super.visitMethodCallExpression(call); final PsiReferenceExpression methodExpression = call.getMethodExpression(); @NonNls final String methodName = methodExpression.getReferenceName(); if ("equals".equals(methodName)) { return; // object method } final PsiExpression qualifier = methodExpression.getQualifierExpression(); if (!(qualifier instanceof PsiReferenceExpression)) { return; } final PsiElement referent = ((PsiReference)qualifier).resolve(); if (!(referent instanceof PsiVariable)) { return; } final PsiExpressionList argumentList = call.getArgumentList(); PsiExpression selfArgument = null; final PsiExpression[] arguments = argumentList.getExpressions(); for (PsiExpression argument : arguments) { if (EquivalenceChecker.getCanonicalPsiEquivalence().expressionsAreEquivalent(qualifier, argument)) { selfArgument = argument; } } if (selfArgument == null) { return; } final PsiType qualifierType = qualifier.getType(); if (!InheritanceUtil.isInheritor(qualifierType, CommonClassNames.JAVA_UTIL_COLLECTION) && !InheritanceUtil.isInheritor(qualifierType, CommonClassNames.JAVA_UTIL_MAP)) { return; } final PsiMethod method = call.resolveMethod(); if (method == null) { return; } final PsiClass aClass = method.getContainingClass(); if (!CollectionUtils.isCollectionClassOrInterface(aClass)) { return; } registerError(selfArgument, methodName); }