PsiExpression (PsiLambdaExpression lambda) { PsiElement lambdaBody = lambda.getBody(); PsiExpression expression = null; if (lambdaBody instanceof PsiExpression) { expression = (PsiExpression)lambdaBody; } else if (lambdaBody instanceof PsiCodeBlock) { PsiStatement[] statements = ((PsiCodeBlock)lambdaBody).getStatements(); if (statements.length == 1 && statements[0] instanceof PsiReturnStatement) { expression = ((PsiReturnStatement)statements[0]).getReturnValue(); } } return PsiUtil.skipParenthesizedExprDown(expression); }