Community
Participate
Working Groups
205. When a class has a field declaration that is an anonymous class and multiple constructors, we can get an ArrayIndexOutOfBoundsException. Here is a test case to reproduce: package p1; import java.util.*; public class A { Object o1 = new Object() { public void foo() { Object o = A.this.bar(); if(o !=null) o.toString(); } }; public A() { } public A(TableModel aM) { } public A(int aNumRows, int aNumColumns) { } public A(Vector aRowData, Vector aColumnNames) { } public A(Object[][] aRowData, Object[][] aColumnNames) { } Object bar() { return null; } }
This problem is fixed and the fix is released in HEAD. The reason of the exception is that the local variable binding didn't reset its initialization count. This was a side-effect of the fact that we regenerate multiple times the anonymous class. The field declaration is included in each constructor.
Fixed in 1.0 Rollup 139