Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Not A Bug
-
Affects Version/s: 1.8.5
-
Fix Version/s: None
-
Component/s: groovy-jdk
-
Environment:Windows command line (to reduce dependencies)
-
Number of attachments :
Description
Running the following script shows 'it' as being null:
dec = { it ->
def x = it
return { println "$
(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')
Please see comments if necessary.