boolean (PsiMethodCallExpression expression) { final PsiMethod method = expression.resolveMethod(); if (method == null || MethodUtils.isFactoryMethod(method)) { return false; } if (ignoreLibraryCalls && method instanceof PsiCompiledElement) { return false; } if (method.getContainingFile() == expression.getContainingFile()) { // consider code in the same file a "friend" return false; } final PsiType type = method.getReturnType(); final PsiClass aClass = PsiUtil.resolveClassInClassTypeOnly(type); if (method.getContainingClass() == aClass) { return false; } return true; }