Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
2.4.2
-
None
Description
There is a regression due to GROOVY-7349. The following code will fail with a VerifyError:
@CompileStatic private void foo(String[] arr) { for (String s in arr) { { -> println(s)}.call() // make s closure shared } }
A workaround is to use an intermediate variable:
@CompileStatic private void foo(String[] arr) { for (String s in arr) { def v = s; { -> println(v)}.call() } }