Pergunta

My Eclipse (Indigo Service Release 2) complains in Guava's DoubleMathTest (current current HEAD, eb89cdb) that the method call

DoubleMath.mean(11, -22, 44, -88);

is ambiguous. There are exactly the following five methods defined

public static double mean(double... values) {...}
public static double mean(long... values) {...}
public static double mean(int... values) {...}
public static double mean(Iterable<? extends Number> values) {...}
public static double mean(Iterator<? extends Number> values) {...}

so I really can't see any ambiguity there. Is this an Eclipse bug?

Foi útil?

Solução

The problem might be sloved by casting. Because Eclipse can't tell what type your arguments are.
try:
DoubleMath.mean(11L, -22L, 44L, -88L);
or
DoubleMath.mean((int)11, (int)-22, (int)44, (int)-88);

EDIT

If the problem was not solved, it might be a problem/bug that varies at different releases of Eclipse.
The code i wrote worked fine for me. (using Juno)
Jon didn't even had a problem with your code (using Kepler).
And the problem was partially solved for you when casting to Double. (using Indigo Service Release 2).

So it must be related to Eclipse release.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top