Groovy
  1. Groovy
  2. GROOVY-5109

inner class inheritance with outer class inheritance can't find constructor

    Details

      Description

      Instantiation fails at runtime if I have an inner class extending an inner class defined in the outer class's parent I get a NoSuchMethodError on instantiation. In other words, C2 extends C1 and C2.B extends C1.A yields C1$A: method <init>()V not found in C2.B's constructor. A repeatable test case is below:

      class FailingInnerClassInheritance {
      	
      	public static void main(String[] args) {
      		new C2()
      	}
      	
      }
      
      class C1 {
      	class A {}
      }
      
      class C2 extends C1 {
      	{ new B() }
      	class B extends C1.A {}
      }
      

      The analogous example works in Java. It fails in Groovy even if we construct B later (after C2 construction) and try to supply various explicit constructors.

        Activity

        Alex Heneveld created issue -
        Cédric Champeau made changes -
        Field Original Value New Value
        Assignee Jochen Theodorou [ blackdrag ] Cedric Champeau [ melix ]
        Cédric Champeau made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 1.8.5 [ 18071 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0-beta-2 [ 18072 ]
        Hide
        Alex Heneveld added a comment -

        Nice, Cedric. Does this also squash GROOVY-5122?

        Show
        Alex Heneveld added a comment - Nice, Cedric. Does this also squash GROOVY-5122 ?
        Hide
        Cédric Champeau added a comment -

        No, I am working on it, but it generates a different error on master.

        Show
        Cédric Champeau added a comment - No, I am working on it, but it generates a different error on master.
        Cédric Champeau made changes -
        Status Resolved [ 5 ] Reopened [ 4 ]
        Resolution Fixed [ 1 ]
        Cédric Champeau made changes -
        Fix Version/s 1.7.11 [ 17244 ]
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Alex Heneveld added a comment -

        Fix confirmed working in master.

        Show
        Alex Heneveld added a comment - Fix confirmed working in master.
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12734033 ] Default workflow, editable Closed status [ 12745802 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12973452 ] Default workflow, editable Closed status [ 12974179 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        15d 5h 41m 1 Cédric Champeau 15/Nov/11 03:05
        Resolved Resolved Reopened Reopened
        3h 40m 1 Cédric Champeau 15/Nov/11 06:45
        Reopened Reopened Resolved Resolved
        1m 12s 1 Cédric Champeau 15/Nov/11 06:46
        Resolved Resolved Closed Closed
        38d 20h 21m 1 Paul King 24/Dec/11 03:08

          People

          • Assignee:
            Cédric Champeau
            Reporter:
            Alex Heneveld
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development