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

A closure created in a closure does not have access to properties on the parent closure's delegate

    XMLWordPrintableJSON

Details

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

    Description

      class C {
      static main(args) {
      c = {
      println x

      x.each

      { println x }

      }

      c.setDelegate(x:0)

      c()
      }
      }

      prints 0 then throws a NPE

      I'm not quite sure what's gong on here:

      I think the owner of the inner closure is not being set to the outer closure. If this is so then it's a classgen issue. If it is being set correctly then it's a runtime issue. If it's a runtime issue can you transfer it to me please Bing?

      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: