Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.2, 2.3.7, 2.4.0-rc-1
Description
When a closure's resolveStrategy is set to DELEGATE_ONLY or DELEGATE_FIRST, resolution is different in nested closures between methods and properties of the delegate. For example, in the following, x resolves to f's delegate (what I expect), but keySet() resolves to g's delegate.
def g = {-> def f = { {-> [x, keySet()]}() } f.resolveStrategy = Closure.DELEGATE_ONLY f.delegate = [x: 1, f: 0] f() } g.delegate = [x: 0, g: 0] g()
Result:
[1, ['x', 'g']]
Whereas without the nested closure
def g = {-> def f = { [x, keySet()] } f.resolveStrategy = Closure.DELEGATE_ONLY f.delegate = [x: 1, f: 0] f() } g.delegate = [x: 0, g: 0] g()
Result: [1, ['x', 'f']]
Attachments
Attachments
Issue Links
- relates to
-
GROOVY-11211 Unexpected invocation of getter method
- Closed