GROOVY-6272: Cannot define a no-args closure in Groovy Shell

Implemented the improvements suggested by Jason