title: for loop in lambda makes it ambiguous
body: <p>When i use a loop in a lambda that could be used as Consumer or Function it becomes ambiguous. This happens when the loop is the last statement.</p>
  
  <p>I already know that i can renaming one of the methods will workaround the problem, but i would like to know why this is happening.</p>
  
  <p>Here is a minimal example:</p>
  
  <pre><code>public class Test {
      public static class A{
          public void a(Consumer&lt;Object&gt; task){
          }
  
          public &lt;R&gt; R a(Function&lt;Object, R&gt; task){
              return null;
          }
      }
  
      public static void main(String[] args) {
          A a = new A();
  
          //okay
          a.a(obj -&gt; {
          });
  
          //not okay: 
          //"The method a(Consumer&lt;Object&gt;) is ambiguous for the type Test.A"
          a.a(obj -&gt; {
              for (int i = 0; i &lt; 1; i++) {
              }
          });
  
          //okay
          a.a(obj -&gt; {
              for (int i = 0; i &lt; 1; i++) {
              }
              {}
          });
      }
  }
  </code></pre>
  
  <p>edit:</p>
  
  <p>reported the bug at eclipse</p>
  
  <p><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=499789" rel="nofollow">https://bugs.eclipse.org/bugs/show_bug.cgi?id=499789</a></p>