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

Precedence of self property over outer class field

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment