Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Not A Problem
-
1.8.5
-
None
-
Windows command line (to reduce dependencies)
Description
Running the following script shows 'it' as being null:
dec = { it ->
def x = it
return { println "${x--} (was $it)" }
}
def f = dec(2)
f(); f();
Output is:
2 (was null)
1 (was null)
If the 'it' references are changed to 'val', then it works fine - i.e. says '(was 2)'
This also fails when no parameter is used (i.e. defaulting to 'it')