Java8 代码停止编译并让我进行不必要的显式转换

Java8 code stop compiling and make me to do an unnecessary explicit casting

我最近更新到 Eclipse Neon,我现有的代码停止编译。似乎是编译器无法进行类型推断,让我进行了不必要的显式转换。 我有这个示例代码:

public class ProductManager {

    //Mocked: originaly a Bean
    com.google.common.util.concurrent.ListeningExecutorService executor;

    public Stream<Result<Product, ItineraryDTO>> getItineraries(Set<Product> productsSet) {
        // Asynchronously get itinerary for every flight
        Stream<ListenableFuture<Result<Product, ItineraryDTO>>> futures =
            productsSet.stream().map(Result.asyncCall(product ->
                    this.executor.submit(() -> this.getItinerary(product)
                )));

        // Wait and get results for every submitted task
        Stream<Result<Product, ItineraryDTO>> results = Result.waitAndGet(futures);
        return results;
    }

    private ItineraryDTO getItinerary(Product flight) {
        // Mocked: originaly get itinerary from a REST service
        return new ItineraryDTO();
    }
    }

asyncCall 方法具有此签名:

public static <T, U> Function<T, ListenableFuture<Result<T, U>>> asyncCall(
            Function<T, ListenableFuture<U>> asyncMethod);

Eclipse 提示我必须转换生成的流。这是 Eclipse 错误还是我做错了什么?

这是 a bug introduced in Eclipse Mars (4.5) (see bug 496942 comment 8 for a reproducing example). It has meanwhile been fixed (as of milestone 1 towards Eclipse Oxygen (4.7)). The fix can be tested using this integration build