Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Consider the following:
@groovy.transform.CompileStatic class Foo { class Bar { def baz } void test() { { -> new Bar(baz: null) }.call() } } new Foo().test()
The constructor call "new Bar(...)" produces an error at runtime:
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' }
Remove the named argument or @CompileStatic and it runs fine.