PsiExpression (@NotNull PsiMethod method) { final PsiCodeBlock body = method.getBody(); if (body == null) { return null; } final PsiStatement[] statements = body.getStatements(); final PsiStatement statement = statements.length != 1 ? null : statements[0]; return statement instanceof PsiReturnStatement ? ((PsiReturnStatement)statement).getReturnValue() : null; }