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/12/19 15:39:00 UTC

[jira] [Updated] (GROOVY-7595) .@ continues to call setter inside closure

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

Eric Milles updated GROOVY-7595:
--------------------------------
    Labels: StackOverflowError  (was: )

> .@ continues to call setter inside closure
> ------------------------------------------
>
>                 Key: GROOVY-7595
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7595
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.4, 2.4.5
>         Environment: @CompileStatic
>            Reporter: Timothy Overly
>            Priority: Major
>              Labels: StackOverflowError
>
> I have a closure that wraps updates to an object:
> {code:java}
> setFoo(Foo foo){
>    doUpdate {
> 	this.@foo = foo
>    }
> }
> {code}
> This causes a stack overflow because it keeps recursively calling setFoo.
> I have tried:
> 1. making foo private/public
> 2. owner.@foo
> 3. delegate.@foo
> Notes:
> 1. This does not cause this overflow in 2.3.x
> 2. The setFoo is part of an interface
> 3. Class is @CompileStatic
> 4. It being in a closure may/may not affect it



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