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

Make @Delegate delegate to inherited property accessors

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.6
    • 2.1.3, 2.2.0-beta-1
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: