I have a generated java interface containing a method:
public Future<?> getCustomersAsync(AsyncHandler<Customer> asyncHandler);
I want to implement it using Akka. I wrote following:
override def getCustomerAsync(asyncHandler: AsyncHandler[Customer]): Future[_] = {
myActorRef.ask(GetCustomer, system.actorOf(Props[Responder]))
}
The issue is that ask
returns scala.concurrent.Future[Any]
and the method must return java.util.concurrent.Future[?]
:
Error:(33, 17) type mismatch;
found : scala.concurrent.Future[Any]
required: java.util.concurrent.Future[?]
myActorRef.ask(GetCustomer, system.actorOf(Props[Responder]))
^
How can I do this conversion?