On 08.11.2016 13:43, Paul King wrote:
Jochen, indeed the Closure version goes through setProperty() but I thought we made it work in methods:import groovy.transform.Field @Field int x = 2 def a() { assert x == 2 println x x = 1 assert x == 1 println x } println x binding.variables.remove('x') a() assert x == 1 println x println binding.variables.x but not closures?
if there is a field of name x, we do directly access the field for the implicit or explicit this.... unless it is an open block, there we access the field only directly if part of the Closure, or an explicit this is used. For property access that happens on something else... for example foo.x ... we also do always go through the MOP.
bye Jochen
