You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/10/29 21:25:00 UTC

[jira] [Assigned] (GROOVY-7208) Script.getProperty vs Script.setProperty asymmetry

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

Eric Milles reassigned GROOVY-7208:
-----------------------------------

    Assignee: Eric Milles

> 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
>
> {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.3.4#803005)