On 08.11.2016 14:47, Krzysztof Kowalczyk wrote:
Jochen Theodorou wrote
there we access the field only directly if [...] an explicit this is
used.
So should prefixing it with "this" should change the behaviour?
It does not:
<pre>
import groovy.transform.Field
@Field
int x = 0
a {
assert this.x == 0
this.x = 1
assert this.x == 1
}
assert x == 0
def a(Closure c) {
c()
}
</pre>
ah right, sorry, this is on a long list of things to be change, but yes,
it does not solve the problem. You can solve it by using this.@x, since
that forces field access, but I think you may still get into trouble
with subclasses...
bye Jochen