[
https://issues.apache.org/jira/browse/GROOVY-12226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18101510#comment-18101510
]
Paul King commented on GROOVY-12226:
------------------------------------
Just a heads-up. We'll look at fixing this in the 5_1_X stream, that stream is
identical to the 5_0_X stream barring a removed method (breaking change) with a
JApplet parameter in Console - shouldn't affect Gradle.
> Double-nested non-static class in trait calling outer method compiles, but
> fails at runtime
> -------------------------------------------------------------------------------------------
>
> Key: GROOVY-12226
> URL: https://issues.apache.org/jira/browse/GROOVY-12226
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 5.0.8
> Reporter: Octavia Togami
> Priority: Major
>
> The following code works in 4.0.33, but fails in 5.0.8:
> {code:groovy}
> trait T {
> static class Outer {
> def outerMethod() { 'p' }
> class Inner { def callOuter() { outerMethod() } }
> def viaInner() { new Inner().callOuter() }
> }
> }
> assert new T.Outer().viaInner() == 'p'
> {code}
> The failure is:
> {code:sh}
> java.lang.NoSuchMethodError: 'java.lang.Object
> T$Outer.this$dist$invoke$1(java.lang.String, java.lang.Object)'
> at T$Outer$Inner.methodMissing(v6_named.groovy)
> at T$Outer$Inner.callOuter(v6_named.groovy:4)
> {code}
> This is because the compiler tries to generate a call to
> {{T$Outer.this$dist$invoke$1}} in {{callOuter}}, but does not generate that
> method in {{T$Outer}}, unlike Groovy 4. It should either produce a proper
> compiler error, or generate the bridge method.
> This was reduced from real code in Gradle:
> https://github.com/gradle/gradle/blob/2e04b0a02ba788075b2be3614f9fc0562ecfaf9d/platforms/native/language-native/src/testFixtures/groovy/org/gradle/language/LanguageTaskNames.groovy#L121
--
This message was sent by Atlassian Jira
(v8.20.10#820010)