I ran in to a strange issue with Vert.x futures the other day that doesn't break the code but bothers me still.
Future without parameter results in the following warning:
Future is a raw type. References to generic type Future should be parameterized
Add the parameter, problem solved:
Future<YourClassName> future = ...
When dealing with a list of futures, you can also parameterize it just fine:
List<Future<YourClassName>> future = ...
But CompositeFuture.all()
can't seem to deal with a parameterized list and forces you to remove the parameter.
Is there any way to make parameterized list of futures work with CompositeFuture
or do we just have to ignore that warning? It doesn't break anything but would still be nice to find a solution to get rid of that warning.
CompositeFuture.all((List<Future>) future)
? This will probably still give you a warning while casting, but at least outside the method call your List will contain Futures that are parameterized. Apart from that i can only think of getting in contact with the vert.x developers and asking them if they would consider changing the method signature of the all method to accept List<Future<?>> – CancerList<Future<YourClassName>> to List<Future>
) error and even if it did work, you would just move the issue from 1 place to another. – CancroidCompositeFuture.all(new ArrayList<Future>(future))
. You are of course right that this doesn't give you much, but at least you could keep the List fully parameterized outside of the .all call and retain some type safety. Maybe someone else has another idea, but unless vert.x changes the signature of that method you probably have to live with having the raw type + warning at some point in your code. – CancerList<? extends Future<?>>
would work – Pyromagnetic