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

Paul King updated GROOVY-7136:
------------------------------
    Fix Version/s: 5.x

> 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
>    Affects Versions: 2.3.7, 2.4.0-beta-3
>            Reporter: Jochen Theodorou
>            Priority: Major
>              Labels: trait, traits
>             Fix For: 5.x
>
>
> Till now, if we have a private field foo in a Trait T, the class implementing 
> the trait can unofficially access the field by this.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 a private field a in the trait T from 
> the trait implementing class. This provide then 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