PsiMethodCallExpression (PsiExpression expression, @NotNull @NonNls String expectedName) { expression = PsiUtil.skipParenthesizedExprDown(expression); if (!(expression instanceof PsiMethodCallExpression methodCallExpression)) return null; if (!expectedName.equals(methodCallExpression.getMethodExpression().getReferenceName())) return null; final PsiMethod method = methodCallExpression.resolveMethod(); if (method == null) return null; PsiMethod[] superMethods = method.findDeepestSuperMethods(); if (superMethods.length == 0) { superMethods = new PsiMethod[]{method}; } return StreamEx.of(superMethods).map(PsiMember::getContainingClass).nonNull().map(PsiClass::getQualifiedName) .has(CommonClassNames.JAVA_UTIL_MAP) ? methodCallExpression : null; }