[concurrency-interest] Incompatible API change between Java 5 and Java 6?

Rémi Forax forax at univ-mlv.fr
Fri Apr 10 02:56:57 EDT 2009


Péter Kovács a écrit :
> Hi,
>
> It appears that the signature of invokeAny and invokeAll in
> ExecutorService has changed from Java 5 and Java 6. I want to
> implement this interface, but I cannot find a signature which is
> accepted by both versions of javac. I have tried this one (accepted by
> Java 5 only):
>
> public <T> List<Future<T>> invokeAll(Collection<Callable<T>> tasks)
>             throws InterruptedException
>
> and this one  (accepted by Java 6 only):
>
> public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
>             throws InterruptedException
>
> Any suggestion appreciated.
>
> Thanks
> Peter
>   
You can use a raw type, you will get warnings but no error.

public <T> List<Future<T>> invokeAll(Collection tasks)
            throws InterruptedException


> PS:
> Generics: much ado about nothing.
>   
Rémi


More information about the Concurrency-interest mailing list