boolean (PsiMethodCallExpression call, PsiExpression argument) { if (!PsiPolyExpressionUtil.isPolyExpression(argument)) return false; PsiExpressionList exprList = ObjectUtils.tryCast(ParenthesesUtils.getParentSkipParentheses(call), PsiExpressionList.class); if (exprList == null) return false; PsiCallExpression parentCall = ObjectUtils.tryCast(exprList.getParent(), PsiCallExpression.class); if (parentCall == null) return false; PsiCallExpression copy = (PsiCallExpression)parentCall.copy(); int argIndex = ContainerUtil.indexOf(Arrays.asList(exprList.getExpressions()), expr -> PsiUtil.skipParenthesizedExprDown(expr) == call); assert argIndex >= -1; PsiExpression argCopy = Objects.requireNonNull(copy.getArgumentList()).getExpressions()[argIndex]; argCopy.replace(argument); JavaResolveResult result = copy.resolveMethodGenerics(); return !result.isValidResult(); }