boolean (@NotNull PsiMethodCallExpression expression, @NonNls @Nullable String calledOnClassName, @Nullable PsiType returnType, @Nullable Pattern methodNamePattern, PsiType @Nullable ... parameterTypes) { final PsiReferenceExpression methodExpression = expression.getMethodExpression(); if (methodNamePattern != null) { final String referenceName = methodExpression.getReferenceName(); if (referenceName == null) { return false; } final Matcher matcher = methodNamePattern.matcher(referenceName); if (!matcher.matches()) { return false; } } final PsiMethod method = expression.resolveMethod(); if (method == null) { return false; } if (calledOnClassName != null) { final PsiExpression qualifier = methodExpression.getQualifierExpression(); if (qualifier != null) { if (!TypeUtils.expressionHasTypeOrSubtype(qualifier, calledOnClassName)) { return false; } return MethodUtils.methodMatches(method, null, returnType, methodNamePattern, parameterTypes); } } return MethodUtils.methodMatches(method, calledOnClassName, returnType, methodNamePattern, parameterTypes); }