[ 
https://issues.apache.org/jira/browse/GROOVY-7208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed GROOVY-7208.
-----------------------------

> Script.getProperty vs Script.setProperty asymmetry
> --------------------------------------------------
>
>                 Key: GROOVY-7208
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7208
>             Project: Groovy
>          Issue Type: Bug
>          Components: GroovyScriptEngine
>    Affects Versions: 2.3.6
>         Environment: During GROOVY-5575 came to this very strange behavior, 
> which we feel is a bug.
>            Reporter: Alexander Petrossian (PAF)
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-beta-1
>
>
> {code:java}
> @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
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to