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

SC: outer class field and self dynamic property

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.0.0-alpha-8
    • 5.0.0-alpha-11
    • Static compilation
    • None

    Description

      The test case described in GROOVY-10985 fails to execute as expected under static compilation if a single reference to the private outer class field is introduced.

      @groovy.transform.CompileStatic
      class Outer {
        private static int VALUE = 1
        class Inner { // NOTE: adding static stops use of bridge method
          def getProperty(String name) {
            if (name == "VALUE") return 2
          }
          void test() {
            if (Outer.VALUE > 0) print 'positive' // creates private access bridge
            print VALUE // classgen now targets private access bridge
          }
        }
        void test() {
          new Inner().test()
        }
      }
      new Outer().test()
      

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: