PsiLambdaExpression (PsiExpression initializer) { PsiExpression expression = PsiUtil.skipParenthesizedExprDown(initializer); if (expression instanceof PsiLambdaExpression lambda) { return lambda; } if (expression instanceof PsiMethodReferenceExpression methodRef) { PsiLambdaExpression lambda = LambdaRefactoringUtil.createLambda(methodRef, true); if (lambda != null) { LambdaUtil.specifyLambdaParameterTypes(methodRef.getFunctionalInterfaceType(), lambda); return lambda; } } return null; }