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

Eric Milles updated GROOVY-7136:
--------------------------------
    Affects Version/s:     (was: 2.3.7)
                           (was: 2.4.0-beta-3)

> allow trait implementing class access to private trait field
> ------------------------------------------------------------
>
>                 Key: GROOVY-7136
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7136
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Compiler
>            Reporter: Jochen Theodorou
>            Priority: Major
>              Labels: traits
>
> Until now, if we have a private field {{a}} in trait {{T}}, the class 
> implementing the trait can unofficially access the field by {{T__a}}. This 
> leaks the naming convention we use, and thus prevents us from changing it 
> some time in the future.
> I suggest to use {{T.this.a}} to access the private field from the trait 
> implementing class. This provides an official way and allows for neat things 
> as immutable traits for example (even if the state is fixed, we still may 
> want one there and the handling of it).



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

Reply via email to