[ https://issues.apache.org/jira/browse/GROOVY-7863?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shil Sinha updated GROOVY-7863: ------------------------------- Description: Example: {code} @groovy.transform.CompileStatic class A { private int bar() { 123 } class B { int testInner() { new C().barInner() } class C { private int barInner() { bar() } } } int test() { new B().testInner() } } assert new A().test() == 123 {code} The code above fails with the following error at runtime: {code} org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'A$B@4c1d9d4b' with class 'A$B' to class 'A' {code} This occurs because the bridge method owner for an 'implicit this' private method call is assumed to be the immediate outer class. was: Example: {code} @groovy.transform.CompileStatic class A { private int bar() { 123 } class B { int testInner() { new C().barInner() } class C { private int barInner() { bar() } } } int test() { new B().testInner() } } assert new A().test() == 123 {code} The code above fails with the following error: {code} org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'A$B@4c1d9d4b' with class 'A$B' to class 'A' {code} This occurs because the bridge method owner for an 'implicit this' private method call is assumed to be the immediate outer class. > Statically compiled calls to private outer class methods fail with multiple > levels of nesting > --------------------------------------------------------------------------------------------- > > Key: GROOVY-7863 > URL: https://issues.apache.org/jira/browse/GROOVY-7863 > Project: Groovy > Issue Type: Bug > Components: Static compilation > Affects Versions: 2.4.7 > Reporter: Shil Sinha > > Example: > {code} > @groovy.transform.CompileStatic > class A { > private int bar() { 123 } > > class B { > int testInner() { new C().barInner() } > > class C { > private int barInner() { bar() } > } > } > int test() { > new B().testInner() > } > } > assert new A().test() == 123 > {code} > The code above fails with the following error at runtime: > {code} > org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast > object 'A$B@4c1d9d4b' with class 'A$B' to class 'A' > {code} > This occurs because the bridge method owner for an 'implicit this' private > method call is assumed to be the immediate outer class. -- This message was sent by Atlassian JIRA (v6.3.4#6332)