[
https://issues.apache.org/jira/browse/GROOVY-11267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmitri Lapchine updated GROOVY-11267:
-------------------------------------
Summary: Trait static methods are not resolved when called from closure
(was: Trait static method is not resolved when called from closure)
> Trait static methods are not resolved when called from closure
> --------------------------------------------------------------
>
> Key: GROOVY-11267
> URL: https://issues.apache.org/jira/browse/GROOVY-11267
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.8
> Reporter: Dmitri Lapchine
> Priority: Major
>
> In trait when calling a method from closure. MissingMethodException thrown
> inside that method when calling any other trait static method.
> {code:java|title=Test code}
> TestClass.getLevel1() // run test
> class TestClass implements TestTrait{}
> trait TestTrait{
> static getLevel1(){ println(['getLevel2':this])
> getLevel2('good') // runs
> def me = this
> 'bad'.with{me.getLevel2(it)} // runs
> 'ugly'.with{getLevel2(it)} // throws getLevel3 not found
> }
> static getLevel2(String s){ println(['getLevel3':this])
> getLevel3(s) // throws MissingMethodException for ugly
> }
> static getLevel3(String s){ println(['getLevel4':this])
> s
> }
> }
> {code}
> {code:none|title=Output}
> No signature of method: static TestTrait.getLevel3() is applicable for
> argument types: (String) values: [ugly]{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)