The following code doesn\'t compile.
package varargspkg;
public class Main {
public static void test(int... i) {
for (int t = 0; t < i.lengt
Why is in this case the error as in the first case not reported? It appears that auto-boxing and automatic type promotion are both applied here. Is auto-boxing applied first the error is resolved?
Just an opinion - in case of varargs the JVM actually has to create an array of arguments. In case of Integer and Float, it's obvious what type of array it should create. So, it probably might be the reason for no ambiguity error.
But still, it's kind of confusing, why it can't create an array of Integers, when by default 1, 3 are ints.
Looks like this has been discussed here in SO in the past bug with varargs and overloading? and is infact a bug, according to the discussion.