The result of the method refers to a raw type compiler warning, but lambda does not

Given:

public static <T> CompletableFuture<? extends List<? extends T>> supplyAllOf(
    List<? extends CompletableFuture<? extends T>> input)
{
    return CompletableFuture.allOf(input.toArray(new CompletableFuture<?>[input.size()])).
        thenApply(ignored -> input.stream().map(CompletableFuture::join).collect(Collectors.toList()));
}

I get a warning from this compiler (using -Xlint):

found raw type: java.util.concurrent.CompletableFuture
  missing type arguments for generic class java.util.concurrent.CompletableFuture<T>

but if I replaced CompletableFuture::joinwith e -> e.join(), the warning will disappear.

Is this a compiler error? If not, why do I see this behavior?

+4
source share
1 answer

Not quite sure, but it looks like this question (or at least its use case).

In any case, this is fixed in 10(just tested) and it does not cause any warnings.

0
source

Source: https://habr.com/ru/post/1694506/