title: Lambda behaving differently than anonymous inner class
body: <p>While doing some basic lambda exercises, the output from an apparently identical anonymous inner class was giving me a different output than the lambda.</p>
  
  <pre><code>interface Supplier&lt;T&gt; {
  
      T get(T t);
  }
  </code></pre>
  
  <p><strong>Scenario #1</strong></p>
  
  <pre><code>Supplier&lt;Integer&gt; s1 = new Supplier&lt;Integer&gt;() {
      @Override
      public Integer get(Integer t) {
          return t;
      }
  };
  Supplier&lt;Integer&gt; s2 = t -&gt; t;
  System.out.println(s1.get(2));
  System.out.println(s2.get(2));
  </code></pre>
  
  <p>Outputs <strong>2</strong> and <strong>2</strong>. Nothing new here.</p>
  
  <hr>
  
  <p>But when I do this:</p>
  
  <p><strong>Scenario #2</strong></p>
  
  <pre><code>Supplier&lt;Integer&gt; s1 = new Supplier&lt;Integer&gt;() {
      @Override
      public Integer get(Integer t) {
          return t++;
      }
  };
  Supplier&lt;Integer&gt; s2 = t -&gt; t++;
  System.out.println(s1.get(2));
  System.out.println(s2.get(2));
  </code></pre>
  
  <p>Outputs <strong>2</strong> and <strong>3</strong></p>
  
  <p><strong>QUESTION: Shouldn't both outputs be identical? Am I missing something?</strong></p>
  
  <hr>
  
  <p>For the sake of completeness:
  <strong>Scenario #3</strong></p>
  
  <pre><code>Supplier&lt;Integer&gt; s1 = new Supplier&lt;Integer&gt;() {
      @Override
      public Integer get(Integer t) {
          return ++t;
      }
  };
  Supplier&lt;Integer&gt; s2 = t -&gt; ++t;
  System.out.println(s1.get(2));
  System.out.println(s2.get(2));
  </code></pre>
  
  <p>Outputs <strong>3</strong> and <strong>3</strong>. Nothing new here as well.</p>
  
  <p><strong>UPDATE: Still getting same output from 1.8.0-b132</strong></p>
  
  <p><strong>UPDATE #2: Bug report:</strong> <a href="https://bugs.openjdk.java.net/browse/JDK-8038420">https://bugs.openjdk.java.net/browse/JDK-8038420</a></p>
  
  <p><strong>UPDATE #3: The bug has been fixed in javac, you should be able to obtain the same result now.</strong></p>