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

super class private members are preferred over public members of the current class with lower priority

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.6, 2.2.0-beta-1, 2.3.0, 2.4.0-rc-1
    • 5.0.0-alpha-1
    • Static compilation
    • None

    Description

      class Foo { private getX() {1}}
      class Bar extends Foo {public x=2}
      @groovy.transform.CompileStatic
      def foo() {
      return new Bar().x
      }
      assert foo()==2
      

      The above example fails at compile time because existsProperty first looks for a getter and finds the private one in Foo. This getter is inaccessible from foo() even in normal Groovy, and should have been ignored instead. If it had been ignored existsProperty might have found Bar#x as a better fit instead

      Attachments

        Activity

          People

            emilles Eric Milles
            blackdrag Jochen Theodorou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: