Community
Participate
Working Groups
A VerifyError exception is thrown when next code is executed: import java.util.ArrayList; import java.util.List; public class test { public static void main(String[] args) { class X { private X[] EMPTY = new X[0]; public X[] foo() { List<X> list = new ArrayList<X>(); return list.size() == 0 ? EMPTY : list.toArray(new X[list.size()]); } }; X x = new X(); } } To workaround the problem, it is necessary to add (X[]) cast: return list.size() == 0 ? EMPTY : (X[])list.toArray(new X[list.size()]); Please note, that this only happens when the code is compiled within Eclipse. When the code is compiled by javac.exe from JDK 1.5 it does work correctly.
I am using 3.1.0 M3. Build id: 200411050810
*** This bug has been marked as a duplicate of 78008 ***