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

Parent class private method shadows derived class private method with the same name.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-5
    • 1.0-RC-1
    • class generator
    • None
    • Windows XP, JDK1.5

    Description

      Consider the following script:

      class A {
      A()

      { init() }
      private void init() { println "A init" }
      }

      class B extends A {
      B() { init() }

      private void init()

      { println "B init" }

      }

      println "Creating an A"
      def a = new A()
      println "Creating a B"
      def b = new B()

      Output:
      Creating an A
      A init
      Creating a B
      A init
      A init

      The last two should read:
      A init
      B init

      Attachments

        1. PrivateMethodShadowTest.groovy
          0.4 kB
          Edward Povazan
        2. PrivateMethodShadowTest.groovy
          0.4 kB
          Edward Povazan

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              emp Edward Povazan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: