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

Closure does not have scope precedent over local method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.6
    • 1.6-rc-1, 1.5.8, 1.7-beta-1
    • syntax
    • None
    • Microsoft Windows XP [Version 5.1.2600]
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
      Groovy Version: 1.5.6 JVM: 1.5.0_04-b05

    Description

      Looking at this SSCCE, the local method selectSql gets called rather than the closure, when the closure should have scope preference. Please find below reference to the discussion about this issue on the groovy-user mailing-list.

      public class Tester {
      private String selectSql()

      {return 'local method'}

      public String returnSql(Closure selectSql)

      { return selectSql() }

      }

      Tester t = new Tester()
      println t.returnSql()

      { 'date,name,value' }

      Reference: http://www.nabble.com/Closure-does-not-have-scope-precedent-over-local-method--td19724860.html#a19724860

      Attachments

        1. Ver2_Groovy3069Bug.groovy
          1 kB
          Roshan Dawrani
        2. Ver2_3069Patches.zip
          3 kB
          Roshan Dawrani
        3. Groovy3069Bug.groovy
          0.6 kB
          Roshan Dawrani
        4. 3069_v17x.diff
          1 kB
          Roshan Dawrani
        5. 3069_v16x.diff
          1 kB
          Roshan Dawrani
        6. 3069_v15x.diff
          1 kB
          Roshan Dawrani

        Activity

          People

            blackdrag Jochen Theodorou
            roshandawrani Roshan Dawrani
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: