You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/03/27 13:56:00 UTC

[jira] [Created] (GROOVY-10985) Precedence of self property over outer class field

Eric Milles created GROOVY-10985:
------------------------------------

             Summary: Precedence of self property over outer class field
                 Key: GROOVY-10985
                 URL: https://issues.apache.org/jira/browse/GROOVY-10985
             Project: Groovy
          Issue Type: Bug
            Reporter: Eric Milles


Consider the following:
{code:groovy}
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()
{code}

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



--
This message was sent by Atlassian Jira
(v8.20.10#820010)