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

Make @Delegate delegate to inherited property accessors

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.6
    • Fix Version/s: 2.1.3, 2.2.0-beta-1
    • Component/s: None
    • Labels:
      None

      Description

      @Delegate already delegates to "regular" methods on a delegate type's base class, but it doesn't do so for inherited property accessors:

      class Foo {
        @Delegate Bar delegate = new Bar()
      
        def foo() {
          bar = "bar" // OK
          baz = "baz" // groovy.lang.MissingPropertyException: No such property: baz for class: Foo
        }
      }
      
      class Bar extends Baz {
        String bar
      }
      
      class Baz {
        String baz
      }
      
      new Foo().foo()
      

      I'm happy to work on this if it is deemed appropriate. Ideally I'd like to get this into 1.8.7.

        Attachments

          Activity

            People

            • Assignee:
              paulk Paul King
              Reporter:
              pniederw Peter Niederwieser
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: