You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/09/07 17:05:00 UTC
[jira] [Updated] (GROOVY-6663) Incorrect order of calling super.method when depth more than two and first class is generic
[ https://issues.apache.org/jira/browse/GROOVY-6663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-6663:
--------------------------------
Affects Version/s: (was: 2.2.1)
(was: 2.4.0-rc-1)
> Incorrect order of calling super.method when depth more than two and first class is generic
> -------------------------------------------------------------------------------------------
>
> Key: GROOVY-6663
> URL: https://issues.apache.org/jira/browse/GROOVY-6663
> Project: Groovy
> Issue Type: Bug
> Reporter: Aleh Bich
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-alpha-2
>
>
> I have following code:
> {code:title=A.groovy}
> package test.groovy
> class A<T> {
> protected String getText(T arg){
> System.out.println( "A does something else");
> return "Class A. -> ";
> }
> }
> {code}
> {code:title=B.groovy}
> package test.groovy
> class B extends A<String> {
> @Override
> protected String getText(String arg) {
> System.out.println("B does something else");
> return super.getText(arg) + "Class B. -> ";
> }
> }
> {code}
> {code:title=C.groovy}
> package test.groovy
> class C extends B {
> @Override
> protected String getText(String arg) {
> System.out.println("C does something else");
> return super.getText(arg) + "Class C. ";
> }
> public static void main(String[] args) {
> def c = new C()
> println(c.getText(null))
> }
> }
> {code}
> I expected to receive next result:
> {code:title=Expected output}
> C does something else
> B does something else
> A does something else
> Class A. -> Class B. -> Class C.
> {code}
> But got the following output:
> {code:title=Actual output}
> C does something else
> A does something else
> Class A. -> Class C.
> {code}
> This issue might have same cause and can duplicate [GROOVY-6653 issue|https://jira.codehaus.org/browse/GROOVY-6653].
--
This message was sent by Atlassian Jira
(v8.20.10#820010)