paulk-asert opened a new pull request, #3365:
URL: https://github.com/apache/groovy/pull/3365
Backport of #3354 (GROOVY-12829) to 6.0.x.
An implicit call of `toString()`, `hashCode()`, `equals`, `getClass()` or an
extension method of `Object` in a nested closure was answered by the
enclosing
closure as an ordinary object. The enclosing closure now passes the call on
to
its own owner and delegate, by its own resolve strategy, so the call means
what
it would in the enclosing closure. An enclosing closure with `TO_SELF`, or
with
no owner and no delegate, still answers it. Dynamic, type checked and
statically compiled code agree.
The code changes are the same as on master. Differences from #3354:
- The closure-guide changes and their spec examples are left out, since the
improved guide is for Groovy 7. The guide's example is kept as a regression
test, `bugs/Groovy12829`, which fails without the `ClosureMetaClass`
change.
- The `COMPATIBILITY.md` entry is the same, without the link to the guide's
"Resolution rules" section, which 6.0.x does not have.
Under `@PackedClosures` a closure making such a call is still left as a
class,
as for any implicit call of a method of `Object` (GROOVY-12576, #3351).
Tests: the closure, lambda, `@DelegatesTo`, packed-closure and closure
metaclass tests pass on 6.0.x (2494 tests, 0 failures).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]