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

Local variable is accessible via explicit this

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.13
    • 2.5.16, 3.0.10, 4.0.1
    • None
    • None

    Description

      def var = "local var"
      new Runnable() {
        def getVar() { "getter" }
        void run() {
          println var // as expected: local var
          println this.var // expected: getter, actual: local var
        }
      }.run()
      

      Attachments

        Activity

          People

            emilles Eric Milles
            daniilo Daniil Ovchinnikov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m