Description
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.
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 } }
Output
No signature of method: static TestTrait.getLevel3() is applicable for argument types: (String) values: [ugly]
Attachments
Issue Links
- relates to
-
GROOVY-8854 MissingMethodException when a public method on a trait calls a static private one in a class hierarchy
- Closed