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

New AST transformation @InheritConstructors

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.7.3, 1.8-beta-1
    • None
    • None

    Description

      I suggest to introduce a new AST transformation @InheritConstructors which can be placed on a class and the class with this annotation will inherit all the constructors of its super class.

      For example:

      class A {
          A() {}
          A(int arg) {}
          A(String arg) {}
      }
      
      @InheritConstructors
      class B extends A {}
      

      Then class B will be equal to:

      class B extends A {
          B() { super() }
          B(int arg) { super(arg) }
          B(String arg) { super(arg) }
      }
      

      I think it is useful, especially for defining exceptions.

      Attachments

        Activity

          People

            paulk Paul King
            johnnyjian Johnny Jian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: