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

an inner closure doesn't use the outer closures delegate to resolve names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-5
    • 1.0-JSR-4
    • class generator
    • None

    Description

      class Test {
      static main(args) {
      c = {
      println "outer x:${x}"

      c1 = {
      println "inner x:${x}"
      }

      c1()
      }

      c.setDelegate(x:'hello')

      c()
      }
      }

      prints outer x:hello
      but throws groovy.lang.MissingPropertyException: No such property: x for class: Test$3 when trying to print x from the inner closure

      I think that this may be the cause of a great deal of the weird behaviour I'm seeing in markup generation

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: