You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/12/18 15:36:00 UTC

[jira] [Updated] (GROOVY-7741) StackoverflowError with Closure and CompileStatic

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

Eric Milles updated GROOVY-7741:
--------------------------------
    Labels: StackOverflowError  (was: )

> StackoverflowError with Closure and CompileStatic
> -------------------------------------------------
>
>                 Key: GROOVY-7741
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7741
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.4.5
>            Reporter: Gerhard Langs
>            Priority: Major
>              Labels: StackOverflowError
>
> run the code below - it fails with a stackoverflow:
> {code}
> $ groovy ClosureStackOverflow.groovy
> Caught: java.lang.StackOverflowError
> java.lang.StackOverflowError
>         at ClosureStackOverflow$_f_closure2.call(ClosureStackOverflow.groovy)
>         at ClosureStackOverflow$_f_closure2.doCall(ClosureStackOverflow.groovy:17)
>         at ClosureStackOverflow$_f_closure2.call(ClosureStackOverflow.groovy)
>         at ClosureStackOverflow$_f_closure2.doCall(ClosureStackOverflow.groovy:17)
>         at ClosureStackOverflow$_f_closure2.call(ClosureStackOverflow.groovy)
>         at ClosureStackOverflow$_f_closure2.doCall(ClosureStackOverflow.groovy:17)
> {code}
> {code}
> import groovy.transform.CompileStatic
> @CompileStatic
> class ClosureStackOverflow {
>     Closure addTextClosure = { "xx" }
>     void f()
>     {
>         List nodes = [ "sth" ]
>         nodes.each {
>             // here we get the overflow:
>             addTextClosure()
>         }
>     }
>     static void main(String[] args) {
>         new ClosureStackOverflow().f()
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)