Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7136

allow trait implementing class access to private trait field

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.3.7, 2.4.0-beta-3
    • 5.x
    • Compiler

    Description

      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).

      Attachments

        Activity

          People

            Unassigned Unassigned
            blackdrag Jochen Theodorou
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: