Community
Participate
Working Groups
First of all, it would be nice, if varargs would be supported really soon now :) Perhaps writing bug reports where others could cc to or vote for would help you to priorize your work... These statements should work: java.lang.reflect.Method m; m.invoke(obj); m.invoke(obj, m); m.invoke(obj, m, m, m); This statement should raise a warning: m.invoke(obj, null); Right now, Cheetah will only accept the last statement but javac will raise a warning: non-varargs call of varargs method with inexact argument type for last parameter.
Released initial support for varargs into today's integration build. But the warning case is not supported yet. I find it strange that javac does not warn when the var arg type is int, as in: void count(int ... v) {} count(null); // no warning but does here: void count(Object ... v) {} count(null); // warning
well - it is the same like: void count(int ai[]) {} and void count2(Object aobj[]) In count(null) the compiler seems to know, that null means a "null pointer" to an array, since native stuff can not be null. In count2(null) it does not known, whether you mean a "null pointer" or a pointer to an array with one "null object" ...
I tried vargs with eclipse-gtk-3.1-I20041013. Most of the time it seems to work. However, in some cases, the IDE still flags none-existing error (i.e. source compiles without problems with Suns's javac 1.5.0). E.g.: public class Message { public static String format(ResourceBundle bundle, String key) {} public static String format(ResourceBundle bundle, String key, Object... args) {} } public class Test { int type = 0; String[] T_NAMES = new String { "foo", "bar" }; String error = "error"; ... Message.format(i18n, "E_UNSUPPORTED_CONV", type); // error Message.format(i18n, "E_SAVE", T_NAMES[type], error); // error ... }
This call will fail because it requires autoboxing (which we don't support yet): Message.format(i18n, "E_UNSUPPORTED_CONV", type); // error An int is not an Object. Try: Message.format(i18n, "E_UNSUPPORTED_CONV", new Integer(type)); // error As for the second case, it worked fine for me.
Oops, didn't know that. Is there a public web page, which show the status of 1.5 support? Perhaps this would help to avoid unnecessary questions ...
Closing this one for now since the initial support is handling the known cases. Future problems will be captured in new PRs.
Verified for 3.1 M3 with build I200411040800