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

Cannot mutate private field from within an AIC or a closure

    XMLWordPrintableJSON

    Details

      Description

      class Foo {
          private int i = 1
          @groovy.transform.CompileStatic
          def m() { new String().with {++i}}
      }
      assert new Foo().m() == 2
      class Bar extends Foo {}
      assert new Bar().m() == 2

      The static compiler is unable to generate code which handles the mutation of a private field like in the example above.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emilles Eric Milles
                Reporter:
                blackdrag Jochen Theodorou
              • 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 - 1h 40m
                  1h 40m