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

more readabel error message when script name is equal to an variabel name

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-10
    • 1.0-beta-10
    • None
    • None

    Description

      given the simple script

      test=1

      in a file named test.groovy results in an Exception like this one:

      Caught: General error during class generation: Cannot use a class expression on the left hand side of an assignment. Node: org.codehaus.groovy.ast.expr.BinaryExpression@1e4457d[org.codehaus.groovy.ast.expr.VariableExpression@18e2b22[variabl
      e: test]("=" at 2:5: "=" )org.codehaus.groovy.ast.expr.VariableExpression@b1c5fa[variable: x]]. At [2:5] H:
      test.groovy

      and much more. Did I use a class on the left hand side? BTW: what is the left hand side? The normal user may not know an answer to these questions. And many don't know you can't have a varibale of the same name as the script name, if no class declaration is used for the script

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            blackdrag Jochen Theodorou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: