void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiExpression arg = ObjectUtils.tryCast(element, PsiExpression.class); if (arg == null) return; PsiMethodCallExpression call = PsiTreeUtil.getParentOfType(arg, PsiMethodCallExpression.class); if (call == null) return; PsiExpression[] args = call.getArgumentList().getExpressions(); int idx = ArrayUtil.indexOf(args, arg); if(idx < 0) return; ExpressionUtils.bindCallTo(call, myName); String lambdaText = myInfo.makeLambda(arg); PsiLambdaExpression lambda = (PsiLambdaExpression)arg.replace(JavaPsiFacade.getElementFactory(project).createExpressionFromText(lambdaText, arg)); LambdaCanBeMethodReferenceInspection.replaceLambdaWithMethodReference(lambda); }