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

Precedence of self property over outer class field

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0.0-alpha-1
    • None

    Description

      Consider the following:

      class Outer {
        private static int VALUE = 1
        static class Inner {
          def getProperty(String name) {
            if (name == "VALUE") return 2
          }
          void test() {
            print VALUE
          }
        }
      }
      new Outer.Inner().test()
      

      Expecting "2" but prints "1". If Inner provides a "generic" property via getProperty, get or via a Map interface it is not used.

      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: