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

Scope bug in using the use directive

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-JSR-1
    • 1.0-JSR-5
    • None
    • None
    • Debian Linux, JDK 5.0

    Description

      The following test case fails.

      void testUseScopeBug() {
      int c = 0
      list = [1,2]
      use(GroovyClosureMethods.class) {
      list.each

      { println it c++ }

      }
      assert c == list.size()
      println "${list.size()} == ${c}"
      }

      The workaround is to place the 'int c = 0' inside the use() directive, however the above should be allowed as this follows common scoping rules.

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              meling Hein Meling
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: