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

Error message needs changing

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.1-rc-2
    • None
    • None
    • Ubuntu 7.04 Feisty Fawn + Groovy SVN HEAD

    Description

      if the script:

      data = [ 3 , 4 , 5 ]
      doSomething = { i -> println ( i ) }
      data.each doSomething
      

      is in a file named doSomething.groovy then the resulting error message is:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, doSomething.groovy: 2: you tried to assign a value to doSomething
      @ line 2, column 1.
      doSomething =

      { i -> println ( i ) }

      ^

      1 error

      this is not particularly informative. The "error" is actually that the script is called doSomething.groovy so the generated class will be called doSomething and so it is not possible to put a varaible of this name into the binding. So the message should be something like: "The script is called doSomething so it is not possible to have variables of that name in the binding."

      Attachments

        Activity

          People

            paulk Paul King
            russel Dr. Russel Winder
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: