title: Cannot infer type argument(s) for <R> map(Function<? super T,? extends R>) in some specific situation
body: <p>I have the following classes in a file Sandbox.java:</p>
  
  <pre><code>package sandbox;
  
  import java.util.Arrays;
  import java.util.Collection;
  import java.util.concurrent.CompletableFuture;
  import java.util.concurrent.ExecutorService;
  import java.util.concurrent.Executors;
  import java.util.stream.Collectors;
  
  public class Sandbox {
  
      public static void main(String[] args) throws Exception {
          ExecutorService executor = Executors.newSingleThreadExecutor();
          Collection&lt;String&gt; s = Arrays.asList(1,2,4,100).stream()
                  .map(i -&gt; CompletableFuture
                          .supplyAsync(() -&gt; Wrapper.of(i), executor)
                          .thenApply(d -&gt; d.get().toString())
                          )
                  .map(CompletableFuture::join)
                  .collect(Collectors.toList());
  
          executor.shutdown();
  
          System.out.println(s);
      }
  }
  
  class Wrapper&lt;T&gt; {
      T t;
  
      private Wrapper(T t) {
          this.t = t;
      }
  
      public T get() {
          return t;
      }
  
      public static &lt;T&gt; Wrapper&lt;T&gt; of (T t) {
          return new Wrapper&lt;&gt;(t);
      }
  }
  </code></pre>
  
  <p>the compilation in Eclipse shows error in line 14 "Cannot infer type argument(s) for  map(Function) ".</p>
  
  <p>The same code compiles without problems using pure javac (JDK 1.8.0_121).</p>
  
  <p>If I change the proper line into:</p>
  
  <pre><code>Collection&lt;String&gt; s = Arrays.asList(1,2,4,100).stream()
                  .map(i -&gt; CompletableFuture
                          .supplyAsync(() -&gt; Wrapper.of(i), executor)
                          .&lt;String&gt;thenApply(d -&gt; d.get().toString())
                          )
                  .map(CompletableFuture::join)
                  .collect(Collectors.toList());
  </code></pre>
  
  <p>then the code compiles without error in Eclipse.</p>
  
  <p>Does anyone know why is there such a behaviour? Is it a bug?</p>
  
  <p>I use Eclipse 4.6.2.20161208-0625 (it finds no updates at the moment).</p>