Jon Keys created GROOVY-7805:
--------------------------------

             Summary: 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)

Reply via email to