PsiExpression (PsiExpression expression, @NotNull TypeEvaluator evaluator) { final PsiMethodCallExpression methodCall = (PsiMethodCallExpression)expression; final PsiExpression[] arguments = methodCall.getArgumentList().getExpressions(); if (arguments.length == 1) { return (PsiExpression)expression.replace(GuavaConversionUtil.adjustLambdaContainingExpression(arguments[0], true, myTargetType, evaluator)); } LOG.assertTrue(arguments.length != 0); final @NonNls StringBuilder replaceBy = new StringBuilder(); final String methodName = methodCall.getMethodExpression().getReferenceName(); for (int i = 1; i < arguments.length; i++) { PsiExpression argument = arguments[i]; replaceBy.append(".").append(methodName).append("(").append(GuavaConversionUtil.adjustLambdaContainingExpression(argument, false, myTargetType, evaluator).getText()).append(")"); } replaceBy.insert(0, GuavaConversionUtil.adjustLambdaContainingExpression(arguments[0], true, myTargetType, evaluator).getText()); final PsiElement parent = expression.getParent(); if (parent instanceof PsiMethodReferenceExpression) { expression = replaceTypeCast(expression, parent); } else if (!GuavaConversionUtil.isJavaLambda(parent, evaluator)) { replaceBy.append("::test"); } final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(expression.getProject()); return (PsiExpression)expression.replace(elementFactory.createExpressionFromText(replaceBy.toString(), expression)); }