Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.1
-
None
-
None
Description
Test example:
class CreatePaymentPanel { def foo() { new SomeFragment() {} } class SomeFragment {} } new CreatePaymentPanel().foo()
Going through the AST I think I located the problem. Inner class is
generated as:
public class CreatePaymentPanel$SomeFragment { public CreatePaymentPanel this$0 public CreatePaymentPanel$SomeFragment(CreatePaymentPanel $p$) { super() this$0 = $p$ } }
so far so good. Anonymous inner class looks like this:
public class CreatePaymentPanel$1 extends CreatePaymentPanel$SomeFragment { public CreatePaymentPanel this$0 public CreatePaymentPanel$1(CreatePaymentPanel p0) { super() this$0 = p0 } }
and method foo:
public Object foo() { new CreatePaymentPanel$1(this) }
The problem lies in `CreatePaymentPanel$1`'s constructor, in
particular its call of `super()`. Its superclass
`CreatePaymentPanel$SomeFragment` defines one constructor with
`CreatePaymentPanel` instance as parameter. If `CreatePaymentPanel$1`
called `super(p0)` all would be fine.