[ https://issues.apache.org/jira/browse/GROOVY-7641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14969606#comment-14969606 ]
Batuhan Bayrakçı commented on GROOVY-7641: ------------------------------------------ Got it, thanks. "this" prefix solved the problem. So, we must be careful about methods' signatures that we call. Adding "this" is a "must practice" for me now. > StackOverflow Exception when calling method that has same signature as one > that inside Closure.groovy > ----------------------------------------------------------------------------------------------------- > > Key: GROOVY-7641 > URL: https://issues.apache.org/jira/browse/GROOVY-7641 > Project: Groovy > Issue Type: Bug > Components: groovy-jdk > Environment: OSX Yosemite 10.10.5 > Reporter: Batuhan Bayrakçı > Assignee: Jochen Theodorou > Attachments: errorlog.txt > > > When i call a method that has same method signature as one inside > Closure.groovy, it causes StackOverflow Exception > I have tried on recent revision of code from github. > {code:title=ImplClass.groovy|borderStyle=solid} > class ImplClass { > def closureAsMethod = { > run() > } > def method() { > run() > } > def run() { > println("run implementation") > } > } > {code} > While {{new ImplClass().method()}} call runs as expected, {{new > ImplClass().closureAsMethod()}} attempts to call "run" method in > Closure.groovy instead of "run" in ImplClass.groovy, then it causes > StackOverflow exception. Stack trace is in attachment. > In {{CallClosureFieldAsMethodTest.groovy}}, comment says that _"Check that we > can call a closure defined as a field as if it were a normal method"_. So, it > is normal to wait same behavior as normal method. -- This message was sent by Atlassian JIRA (v6.3.4#6332)