[ https://issues.apache.org/jira/browse/GROOVY-7891?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-7891. ----------------------------- > Possible Problem With Closures Calling Private Methods In A Trait > ----------------------------------------------------------------- > > Key: GROOVY-7891 > URL: https://issues.apache.org/jira/browse/GROOVY-7891 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.4.5 > Reporter: Jeff Scott Brown > Assignee: Paul King > Priority: Major > > It looks like a closure defined in a trait does not have access to private > methods defined in the trait. I am not sure if this is broken or not. > {code} > trait SomeTrait { > void somePublicMethod() { > def someClosure = { > somePrivateMethod() > } > someClosure() > } > private void somePrivateMethod() {} > } > {code} > {code} > class Demo implements SomeTrait { > static void main(args) { > new Demo().somePublicMethod() > } > } > {code} > {code} > $ groovy Demo > Caught: groovy.lang.MissingMethodException: No signature of method: > Demo.somePrivateMethod() is applicable for argument types: (Demo) values: > [Demo@2473d930] > groovy.lang.MissingMethodException: No signature of method: > Demo.somePrivateMethod() is applicable for argument types: (Demo) values: > [Demo@2473d930] > at > SomeTrait$Trait$Helper$_somePublicMethod_closure1.doCall(SomeTrait.groovy:5) > at > SomeTrait$Trait$Helper$_somePublicMethod_closure1.doCall(SomeTrait.groovy) > at SomeTrait$Trait$Helper.somePublicMethod(SomeTrait.groovy:7) > at SomeTrait$Trait$Helper$somePublicMethod.call(Unknown Source) > at Demo.somePublicMethod(Demo.groovy) > at SomeTrait$somePublicMethod.call(Unknown Source) > at Demo.main(Demo.groovy:3) > {code} > Please advise. Thanks for the input. > https://github.com/grails/grails-core/issues/10060 -- This message was sent by Atlassian JIRA (v7.6.3#76005)