Unnecessary enclosing instance parameters for anonymous class constructor
Issue #237
new
ExtendJ 8.0.1-235-g5497af4 Java SE 8
The constructor for the anonymous class in this test should only require one enclosing instance parameter, but ExtendJ generates two enclosing parameters:
public final class Test {
public static void main(String[] args) {
new Test().run();
}
private abstract class AbstractTest {
public abstract void test();
}
public void run() {
new AbstractTest() {
public void test() {
System.out.println("x marks the spot");
}
}.test();
}
}
Expected result: only one enclosing parameter. The code generated by javac is:
Test$1(Test);
Code:
0: aload_0
1: aload_1
2: putfield #1 // Field this$0:LTest;
5: aload_0
6: aload_1
7: aconst_null
8: invokespecial #2 // Method Test$AbstractTest."<init>":(LTest;LTest$1;)V
11: return
Actual result: two enclosing parameters are generated.