title: Using lambda impedes inference of type variable
body: <p>I have the following code which compiles successfully:</p>
  
  <pre><code>import java.lang.String;
  import java.util.List;
  import java.util.Arrays;
  
  interface Supplier&lt;R&gt; {
      Foo&lt;R&gt; get();
  }
  
  interface Foo&lt;R&gt; {
      public R getBar();
      public void init();  
  }
  
  public class Main {
  
      static private &lt;V&gt; void doSomething(final Supplier&lt;? extends List&lt;? extends V&gt;&gt; supplier) {
      // do something
      }
  
      static public void main(String[] args) {
          doSomething(new Supplier&lt;List&lt;Object&gt;&gt;(){
             @Override
             public Foo&lt;List&lt;Object&gt;&gt; get() {
                 return new Foo&lt;List&lt;Object&gt;&gt;(){
                     @Override
                     public List&lt;Object&gt; getBar() {
                         return null;
                     }
                     @Override
                     public void init() {
                        // initialisation
                     }
                 };
              }
         });
      }
  }
  </code></pre>
  
  <p>However, if I convert the <code>Supplier</code> to the following lambda expression the code does not compile anymore:</p>
  
  <pre><code>doSomething(() -&gt; new Foo&lt;List&lt;Object&gt;&gt;(){
      @Override
      public List&lt;Object&gt; getBar() {
          return null;
      }
  });
  </code></pre>
  
  <p>The compiler error is:</p>
  
  <pre><code>Main.java:22: error: method doSomething in class Main cannot be applied to given types;
      doSomething(() -&gt; new Foo&lt;List&lt;Object&gt;&gt;(){
      ^
    required: Supplier&lt;? extends List&lt;? extends V&gt;&gt;
    found: ()-&gt;new Fo[...]; } }
    reason: cannot infer type-variable(s) V
      (argument mismatch; bad return type in lambda expression
        &lt;anonymous Foo&lt;List&lt;Object&gt;&gt;&gt; cannot be converted to Foo&lt;List&lt;? extends V&gt;&gt;)
    where V is a type-variable:
      V extends Object declared in method &lt;V&gt;doSomething(Supplier&lt;? extends List&lt;? extends V&gt;&gt;)
  </code></pre>
  
  <p>If I change the declaration of the supplier to <code>Supplier&lt;? extends List&lt;V&gt;&gt;</code>, both variants compile successfully.</p>
  
  <p>I compile the code with a Java 8 compiler.</p>
  
  <p>Why does the code with the lambda not compile, although it is equivalent to the non-lambda version?
  Is this a known/intended limitation of Java or is it a bug?</p>