Question

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?

Was it helpful?

Solution

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));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top