GrExpression (@NotNull GrMethod method) { GrOpenBlock body = method.getBlock(); assert body != null; GrStatement[] statements = body.getStatements(); if (statements.length == 1) { if (statements[0] instanceof GrExpression) return (GrExpression) statements[0]; if (statements[0] instanceof GrReturnStatement) { GrExpression value = ((GrReturnStatement) statements[0]).getReturnValue(); if (value == null && !PsiTypes.voidType().equals(PsiUtil.getSmartReturnType(method))) { return GroovyPsiElementFactory.getInstance(method.getProject()).createExpressionFromText("null"); } return value; } } return null; }