Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.6
-
None
-
During
GROOVY-5575came to this very strange behavior, which we feel is a bug.
Description
@groovy.transform.Field i = 5 assert getProperty("i") == 5 // ok assert i == 5 // ok setProperty("i", getProperty("i") + 1) assert getProperty("i") == 6 // ok assert i == 6 // fails, i is currently 5
Effectively
- script.getProperty did read script.i field
- while script.setProperty stored value only to Binding, not to script.i field
Please consider script.setProperty to detect that there is script.$name field, and if there is, write there and only there to match getProperty behavior.