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

Static compiler sometimes use setProperty where it could make direct access

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.1
    • Component/s: Static compilation
    • Labels:
      None

      Description

      Take the following code:

      @groovy.transform.CompileStatic
      class Test {
          A a = new A()
          void foo() {
              a.x = 1
          }
      }
      class A { 
          int x
      }
      
      new Test().foo()
      

      The static compiler sets the "x" variable from A using ScriptBytecodeAdapter.setProperty although it could use A#setX.

        Attachments

          Activity

            People

            • Assignee:
              melix Cédric Champeau
              Reporter:
              melix Cédric Champeau
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: