Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1742

Change compiler error message "Closure expression looks like it may be an isolated open block" to make it more clear

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 1.0
    • 1.5.2
    • None
    • None

    Description

      Running

      { println "foo" }

      in the groovyConsole results in the compiler error message "Closure expression looks like it may be an isolated open block.;
      solution: Add an explicit parameter list, as in

      {it -> ...}, or label it as L:{...}.". For me as a groovy newbie it wasn't clear that the first solution marks the code as closure while the second marks it as block, I thought that both would result in a closure. Perhaps the wording should be changed to something like this:

      "Expression could be either a closure expression or an isolated open block. Solution: Add an explicit parameter list, as in {it -> ...}

      , to create a closure or label it as L:

      {...}

      to mark it as block."

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            paulk Paul King
            mkoch Michael Koch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment