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

Paul King closed GROOVY-11044.
------------------------------

> SC: property access within closure produces cast exception
> ----------------------------------------------------------
>
>                 Key: GROOVY-11044
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11044
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 4.0.12
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.12
>
>
> Consider the following:
> {code:groovy}
> class Bar {
>   @groovy.beans.Bindable
>   String baz
>   String other
> }
> class Foo {
>   Bar bar
>   @groovy.beans.Bindable
>   String foo
>   @groovy.transform.CompileStatic
>   void postConstruct() {
>     bar = new Bar()
>     bar.with {
>       addPropertyChangeListener('baz') { event ->
>         other = 'value' // ClassCastException: class Foo cannot be cast to 
> class Bar
>         print 'changed'
>       }
>     }
>     print 'ready;'
>   }
> }
> Foo foo = new Foo()
> foo.postConstruct()
> foo.getBar().setBaz('xxx')
> {code}



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

Reply via email to