boolean (@NotNull PsiMethodCallExpression innerMethodCallExpression, @NotNull PsiMethodCallExpression enclosingMethodCallExpression) { PsiExpressionList expressionList = PsiTreeUtil.getParentOfType(innerMethodCallExpression, PsiExpressionList.class); if (expressionList == null) return false; PsiMethod enclosingMethod = enclosingMethodCallExpression.resolveMethod(); if (enclosingMethod == null) return false; PsiClass aClass = enclosingMethod.getContainingClass(); if (aClass == null) return false; int position = getExpressionPosition(expressionList, innerMethodCallExpression); return Arrays.stream(aClass.findMethodsByName(enclosingMethod.getName(), true)) .filter(method -> PsiUtil.isMemberAccessibleAt(method, innerMethodCallExpression)) .anyMatch(method -> areExpressionsConvertibleToMethodParameters(expressionList.getExpressionTypes(), method.getParameterList().getParameters(), position)); }