[ https://issues.apache.org/jira/browse/GROOVY-11267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-11267: ------------------------------------ Assignee: Eric Milles > 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 > Assignee: Eric Milles > Priority: Major > Labels: traits > > In trait when calling a method from closure. MissingMethodException thrown > inside that method when calling any other trait static method. (This is not > the case when *class* is used instead of {*}trait{*}) > When in "ugly" case, _*this*_ context is switched to > _*TestTrait$Trait$Helper*_ from {_}*TestClass*{_}. > {code:java|title=Test code} > TestClass.getLevel1() // run test > class TestClass implements TestTrait{} > trait TestTrait{ > static getLevel1(){ println(['getLevel1':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(['getLevel2':this]) > getLevel3(s) // throws MissingMethodException for ugly > } > static getLevel3(String s){ println(['getLevel3':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)