jenkinsci/groovy-sandbox

MissingPropertyException for "it" in closures

shrtminded opened this issue · 8 comments

The code below throws a MissingPropertyException when using it inside of closures after version 1.5.

Example 1:

log = ''
(1..10).each{log += it}

Example 2:

list =["foo", "bar"]
index = list.findIndexOf{ it == "foo"}

Already filed as JENKINS-33468.

Hi guys, Is there any fundamental issue preventing fixing this? Any plan to fix it in near future?
Thanks.

I cannot use Jenkinsfile from SCM and I am blocked due to this

Is there any fundamental issue preventing fixing this?

Unknown until someone tries to fix it.

Any plan to fix it in near future?

Not currently. Feel free to upvote the JIRA issue or file a PR.

I am blocked due to this

Unlikely. There is a trivial workaround, as described in JIRA.

1fffecf

This change adds support for implicit "it"

@jglick could you have a look at my PR submitted for this fix? thanks.

Refiled as #38 by @abayer.

Going by Git tags, looked like the fix for this was released in version 1.14.