"method is ambiguous for the type" but the types are NOT ambiguous (and the error comes by upgrade from eclipse 3.7.2 to eclipse 4.2)
compiler-construction, eclipse, java
Solution
This was reported as a bug in eclipse bug 383780. Here is the documentation of the fix: https://bugs.eclipse.org/bugs/attachment.cgi?id=218320
Basically, to fix the compiler error, get the latest eclipse release(4.2.1 as of now), add the following line after `-vmargs` in `eclipse.ini`: (then you might need to restart eclipse and rebuild you projects)
-DtolerateIllegalAmbiguousVarargsInvocation=true
That being said, Samuel is correct: the method invocation is ambiguous. The code example above worked before because there was a bug in JDK before 1.6; and the custom compiler in eclipse successfully mimicked this bug. When developing Juno, they fixed this bug (because the JDK bug was fixed in 1.7) by reporting ambiguous invocation as an error, annoying a lot of people (including me). The fix above asks you to explicitly tell eclipse to "tolerate Illegal Ambiguous Varargs Invocation".
Problem
I have defined: ``` public static int[] getArray( final int... params ) { return params; } public static <T> T[] getArray( final T... params ) { return params; } ``` And I use this in ``` getArray( 1, 2 ) ``` and now I get in eclipse 4.2 the compile error: method is ambiguous for the type But as you can see this is not ambiguous. What can I do?