Ambiguous reference

Vicente-Arturo Romero-Zaldivar vicente.romero at oracle.com
Fri Nov 15 06:04:22 PST 2013


On 13/11/13 19:14, Zhong Yu wrote:
> One thing I find quite worrisome in the new overload resolution - In
> Java7, applicable methods are "actually" applicable. The "choosing the
> most specific method" step is guaranteed to chose an actually
> applicable method.
>
> In Java8, that's not the case in a lot of times. Applicable methods
> may not be actually applicable, and the "most specific" step may
> choose a method that fails to pass further compilation.
>
> This can be quite confusing to the programmer:
>
> case 1. javac reports ambiguity because two methods are applicable -
> while it is very clear to the programmer that one of the method is not
> actrually applicable.
>
> case 2. javac chooses the most specific method, then finds that it is
> not actually applicable, reports that arguments do not fit the
> parameter types - while it seems very clear to the programmer that
> this method should not be a candidate in the first place.
>
>
> Zhong Yu
>
Hi,

If you are referring to the specific case of lambdas what the compiler 
says is that both methods match, not that they are applicable. Probably 
the error message can be clearer.

Vicente


More information about the lambda-dev mailing list