[ 
https://issues.apache.org/jira/browse/GROOVY-7641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Batuhan Bayrakçı updated GROOVY-7641:
-------------------------------------
    Description: 
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()}} 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.


  was:
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()}} causes StackOverflow exception. Stack trace is 
in attachment.

In {{CallClosureFieldAsMethodTest.groovy}}, comment says _"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.



> StackOverflow Exception when calling method that has same signature as one 
> that inside a closure
> ------------------------------------------------------------------------------------------------
>
>                 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çı
>         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()}} 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)

Reply via email to