You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2021/03/23 09:32:00 UTC

[jira] [Updated] (GROOVY-9993) CLONE - Field and a property with the same name: clarification of boundary cases

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

Paul King updated GROOVY-9993:
------------------------------
    Summary: CLONE - Field and a property with the same name: clarification of boundary cases  (was: CLONE - Field and a property with the same name: edge case)

> CLONE - Field and a property with the same name: clarification of boundary cases
> --------------------------------------------------------------------------------
>
>                 Key: GROOVY-9993
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9993
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>              Labels: breaking
>             Fix For: 4.0.0-alpha-3
>
>
> A field and property with the same name cause the field to become the backing field for the property, allowing to override the default private field that would normally be created, however the initial value, if supplied as part of the property is ignored:
> {code}
> class X {
>     protected x
>     def x = 3
> }
> new X().x // => null
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)