You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2026/09/03 06:04:00 UTC

[jira] [Resolved] (GROOVY-12309) Closure calls with Object[] parameter under static compilation get the wrong argument

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

Paul King resolved GROOVY-12309.
--------------------------------
    Fix Version/s: 6.0.0-beta-4
       Resolution: Fixed

> Closure calls with Object[] parameter under static compilation get the wrong argument
> -------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12309
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12309
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 6.0.0-alpha-1, 5.0.3, 4.0.31
>            Reporter: Björn Kautler
>            Assignee: Jochen Theodorou
>            Priority: Major
>             Fix For: 6.0.0-beta-4
>
>
> With
> {code:java}
> class Foo {
>   def foo() {
>     { Object[] foo -> println(foo) }.call(new Object[] { 'foo' })
>   }
> }
> new Foo().foo() {code}
> you get {{[foo]}} printed.
> Adding {{@groovy.transform.CompileStatic}} it prints {{{}[[foo]]{}}}.
> Removing the {{Object[]}} with added static-compilation it again prints {{{}[foo]{}}}.
> The closure under static compilation should get the same parameter and not wrapped in another {{{}Object[]{}}}.
> This is caused by the {{call}} / {{doCall}} methods generated for the closure.
> The {{call}} call where it happens in production is a precompiled Java code that gives the same argument in either case.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)