Summary: | [1.5] Please support varargs | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Stefan Matthias Aust <sma> |
Component: | Core | Assignee: | Kent Johnson <kent_johnson> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 3.0 | ||
Target Milestone: | 3.1 M3 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Stefan Matthias Aust
2004-07-14 15:21:15 EDT
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 |