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

Paul King closed GROOVY-11876.
------------------------------

> SwingBuilder closure bind: typed vs untyped (def) property
> ----------------------------------------------------------
>
>                 Key: GROOVY-11876
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11876
>             Project: Groovy
>          Issue Type: Bug
>          Components: Swing
>    Affects Versions: 5.0.4
>            Reporter: Gregory Moltchadski
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.5
>
>
> SwingBuilder's closure bind works fine with untyped local properties 
> (declared with "def"), but doesn't with typed ones, see attached piece of 
> code. Note that in Groovy 4, both cases didn't work at all.
> {code:java}
> import groovy.beans.Bindable
> import groovy.swing.SwingBuilder
> class Main
> {
>   @Bindable static class Bean
>   {
>     String foo = 'bar'
>   }
>   static def bean1 = new Bean()
>   static Bean bean2 = new Bean()
>   static void main(String[] args)
>   {
>     new SwingBuilder().edt {
>       label1 = label(text: bind { bean1.foo })
>       label2 = label(text: bind { bean2.foo })
>       assert label1.text == 'bar'
>       bean1.foo = 'baz'
>       assert label1.text == 'baz'
>       assert label2.text == 'bar'
>       bean2.foo = 'baz'
>       assert label2.text == 'baz' // Boom!
>     }
>   }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to