You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jon Keys (JIRA)" <ji...@apache.org> on 2016/03/31 22:07:25 UTC

[jira] [Closed] (GROOVY-7805) Infinite loop when invoking member closure from runtime closure

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

Jon Keys closed GROOVY-7805.
----------------------------
    Resolution: Duplicate

> Infinite loop when invoking member closure from runtime closure
> ---------------------------------------------------------------
>
>                 Key: GROOVY-7805
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7805
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.4.6
>         Environment: Linux x86-64 / java 1.8.0_73
>            Reporter: Jon Keys
>
> The code below demonstrates an issue where invoking a member closure from a runtime closure causes an infinite loop:
> {code:java}
> @CompileStatic
> class Test {
>     Closure flush = {
>         println "flushing"
>     }
>     public void doStuff() {
>         Closure tmp = { String s ->
>             println "inside tmp"
>             println "operating on $s (${s.length()})" // do something with the arg to purposefully throw a NPE, otherwise we enter an endless loop
>             flush()
>         }                
>         tmp('test')           
>     }
> }
> new Test().doStuff()
> {code}
> If I remove the {{@CompileStatic}} annotation the sample code runs as expected.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)