You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/02/01 23:19:01 UTC

[jira] [Closed] (GROOVY-7679) calling super in Groovy (version 2.4.5) miss the parent class?

     [ https://issues.apache.org/jira/browse/GROOVY-7679?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-7679.
-----------------------------

> 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
>             Fix For: 2.4.8
>
>
> 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}
> 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 has been verified by me.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)