[
https://issues.apache.org/jira/browse/GROOVY-11122?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-11122.
------------------------------
> SC: map-style constructor call for non-static inner class within closure
> ------------------------------------------------------------------------
>
> Key: GROOVY-11122
> URL: https://issues.apache.org/jira/browse/GROOVY-11122
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Labels: VerifyError
> Fix For: 4.0.14, 3.0.19
>
>
> Consider the following:
> {code:groovy}
> @groovy.transform.CompileStatic
> class Foo {
> class Bar {
> def baz
> }
> void test() {
> { ->
> new Bar(baz: null)
> }.call()
> }
> }
> new Foo().test()
> {code}
> The constructor call "new Bar(...)" produces an error at runtime:
> {code}
> VerifyError: Bad type on operand stack
> Exception Details:
> Location:
> Foo$_test_closure1.doCall()LFoo$Bar; @5: invokespecial
> Reason:
> Type 'Foo$_test_closure1' (current frame, stack[2]) is not assignable to
> 'Foo'
> Current Frame:
> bci: @5
> flags: { }
> locals: { 'Foo$_test_closure1' }
> stack: { uninitialized 0, uninitialized 0, 'Foo$_test_closure1' }
> {code}
> Remove the named argument or {{@CompileStatic}} and it runs fine.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)