On Mon, 19 Sep 2005 15:45:24 +0100, Matthew Toseland wrote: >> did you hear that, developers? vararg methods should NOT be >> overloaded. I think you can safely ignore them. Maybe you can >> convince some of the developers to get rid of them from 0.7. > > Hmm. Where do we use varargs? I haven't put any into 0.7, unless in > imported code from e.g. Dijjer... What do varargs look like, so I can > search for them?
The problem is the reflection API which has been redesigned to use varargs, see e. g. | <http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Method.html#invoke(java.lang.Object, java.lang.Object...)> but still allowing the "old way" for compatibility. When you have "old" java code that calls such a varargs method with a null parameter for the "Object...", it is ambiguous whether the null is an (Object[])null (i.e. old calling convention) or the first and only Object for the varargs (i.e. new calling convention). To fix, either specify -source 1.4 (or lower) in your makefiles, or add an explicit cast to (Object[]) for all that "legacy" varargs calls. HTH, Michael
