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

undefined variables behave differently in scripts and classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-6
    • 1.0-beta-7
    • None
    • None

    Description

      println x

      prints null

      class C {
      static main(args)

      { println x }

      }

      throws a MissingPropertyException

      this has the unfortunate consequence that closure delegates don't work in Scripts

      c =

      {println x}

      x.delegate =['x':100]
      c()

      prints null rather than 100

      This breaks some features of XML-RPC and StreamingMarkupBuilder (and, presumably other things)

      Attachments

        Activity

          People

            tug John Wilson
            tug John Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: