title: State of Lambda and Imperfections in Anonymous Classes
body: <p>I was reading again Brian Goetz document on the <a href="http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-final.html" rel="nofollow">State of Lambda</a> where he details many of the reasons why Java needed lambda expressions.</p>
  
  <p>In one of the paragraphs he wrote:</p>
  
  <blockquote>
    <p>Given the increasing relevance of callbacks and other functional-style
    idioms, it is important that modeling code as data in Java be as
    lightweight as possible. In this respect, anonymous inner classes are
    imperfect for a number of reasons, primarily:</p>
    
    <ol>
    <li>Bulky syntax</li>
    <li>Confusion surrounding the meaning of names and <code>this</code></li>
    <li>Inflexible class-loading and instance-creation semantics</li>
    <li>Inability to capture non-final local variables</li>
    <li>Inability to abstract over control flow</li>
    </ol>
  </blockquote>
  
  <p>From this list of imperfections I believe I understand reasonably well the items (1), (2) and (4).</p>
  
  <p>But I have no clue of what exactly the problems are in (3) and (5).</p>
  
  <p>Can anybody out there provide any examples of how these two could be an issue when using anonymous classes?</p>
  
  <p>Not all the projects I work on are yet on Java 8 and so I think it is important to understand these shortcomings and above all see clearly how things are better now with Java 8 lambdas. Also, since Brian was one of the leaders of the project lambda I thought it was worth my time to give it some thought to what he meant by this, it could lead me to an epiphany :-)</p>