Groovy
  1. Groovy
  2. GROOVY-2621

Local variable shadows method in closure call, even if method is called with this keyword.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
    • Component/s: None
    • Labels:
      None

      Description

      testSimilarNamesForMethodAndLocalWithLocalAsMethodArgument fails.

      class DelegationTest extends GroovyTestCase {
          void testSimilarNamesForMethodAndLocalWithLocalAsMethodArgument() {
              new Executer().failingExecute()
          }
          void testSimilarNamesForMethodAndLocalWithNoArgMethod() {
              new Executer().workingExecute()
          }
      }
      
      class Executer {
          void convention(String arg) {
               println 'called'
          }
      
          void convention() {
               println 'called'
          }
      
          void failingExecute() {
              def convention= 'value'
              10.times {
                  this.convention(convention)
              }
          }
          void workingExecute() {
              def convention= 'value'
              10.times {
                  this.convention()
              }
          }
      }
      

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          289d 19h 35m 1 Roshan Dawrani 10/Dec/08 20:22
          Resolved Resolved Closed Closed
          12d 9h 36m 1 Paul King 23/Dec/08 05:58
          Mark Thomas made changes -
          Workflow jira [ 12969591 ] Default workflow, editable Closed status [ 12977352 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
          Mark Thomas made changes -
          Workflow jira [ 12731657 ] Default workflow, editable Closed status [ 12743396 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
          Paul King made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Roshan Dawrani made changes -
          Fix Version/s 1.7-beta-1 [ 14014 ]
          Fix Version/s 1.6-rc-1 [ 14009 ]
          Resolution Duplicate [ 3 ]
          Fix Version/s 1.5.8 [ 14630 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Hide
          Roshan Dawrani added a comment -

          Fixed by the GROOVY-3156 patch as it was related to the exactly same issue.

          Show
          Roshan Dawrani added a comment - Fixed by the GROOVY-3156 patch as it was related to the exactly same issue.
          Roshan Dawrani made changes -
          Assignee Roshan Dawrani [ roshandawrani ]
          Hide
          Roshan Dawrani added a comment -

          Internally, GROOVY-3156 and GROOVY-2621 are found to be related to the exact same implementation issue and same (GROOVY-3156) patch solves both these issues.

          Show
          Roshan Dawrani added a comment - Internally, GROOVY-3156 and GROOVY-2621 are found to be related to the exact same implementation issue and same ( GROOVY-3156 ) patch solves both these issues.
          Roshan Dawrani made changes -
          Link This issue is related to GROOVY-3156 [ GROOVY-3156 ]
          Jochen Theodorou made changes -
          Link This issue depends upon GROOVY-3156 [ GROOVY-3156 ]
          Jochen Theodorou made changes -
          Field Original Value New Value
          Link This issue depends upon GROOVY-3156 [ GROOVY-3156 ]
          Hide
          Roshan Dawrani added a comment -

          This bug is internally related to same implementation issue in ACG as identified in GROOVY-3156. Even this is case of a method call expression explicitly qualified by "this" being made inside a closure when compileStack contains a variable of the same name as the method.

          The patches supplied with GROOVY-3156 fix this issue as well on versions 1.5.8, 1.6-RC-1, 1.7-beta-1. I have test verified.

          rgds,
          Roshan

          Show
          Roshan Dawrani added a comment - This bug is internally related to same implementation issue in ACG as identified in GROOVY-3156 . Even this is case of a method call expression explicitly qualified by "this" being made inside a closure when compileStack contains a variable of the same name as the method. The patches supplied with GROOVY-3156 fix this issue as well on versions 1.5.8, 1.6-RC-1, 1.7-beta-1. I have test verified. rgds, Roshan
          Hans Dockter created issue -

            People

            • Assignee:
              Roshan Dawrani
              Reporter:
              Hans Dockter
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development