Pergunta
I'm getting this warning while compling my code (with -Xlint options):
receptor.java:286: warning: [unchecked] unchecked call to
FutureTask(java.util.concurrent.Callable<V>) as a member
of the raw type java.util.concurrent.FutureTask
The line that generates the warning:
FutureTask task = new FutureTask (new Return(address, lock));
And the Return class implements Callable:
public class Return implements Callable <String> {
How can I fix the warning?
Solução
According to the FutureTask
documentation, this class is a generic class as well. This means you'll need
FutureTask<String> task = new FutureTask<String>(new Return(address, lock));
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow