Jochen Theodorou created GROOVY-7679:
----------------------------------------

             Summary: calling super in Groovy (version 2.4.5) miss the parent 
class?
                 Key: GROOVY-7679
                 URL: https://issues.apache.org/jira/browse/GROOVY-7679
             Project: Groovy
          Issue Type: Bug
          Components: groovy-runtime
    Affects Versions: 2.4.5
            Reporter: Jochen Theodorou


Taken from 
http://stackoverflow.com/questions/33764666/why-does-calling-super-in-groovy-version-2-4-5-miss-the-parent-class

{code:Java}
class GrandParent { 
    String init() { 
        return "GrandParent init, " 
    } 
}

class Parent extends GrandParent { 
    String init() { 
        return super.init() + "Parent init, " 
    } 
}

class ChildInitAndVisit extends Parent { 
    String init() { 
        return super.init() + "Child init" 
    }

    String visit() { 
        return super.init() + "Child visit" 
    } 
}

class ChildVisitOnly extends Parent { 
    String visit() { 
        return super.init() + "Child visit" 
    } 
}

iv = new ChildInitAndVisit()
println "ChildInitAndVisit - calling init() -> ${iv.init()}"
println "ChildInitAndVisit - calling visit() -> ${iv.visit()}"

v = new ChildVisitOnly()
println "ChildVisitOnly - calling visit() -> ${v.visit()}"
{code:Java}

I would expect to see:
{{ChildVisitOnly - calling visit() -> GrandParent init, Parent init, Child 
visit}}

as the output of the last println. Instead I see:
{{ChildVisitOnly - calling visit() -> GrandParent init, Child visit}}

The bug hen verified by me.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to