title: Debugger cannot see local variable in a Lambda
body: <p>I noticed that when I hover my mouse over a local variable when my debugger is stopped inside a lambda it will report <code>Cannot find local variable 'variable_name'</code> even if it's visible inside the lambda and it's used.</p>
  
  <p>Example code</p>
  
  <pre><code>public class Main {
      public static void main(String[] args) {
          String a = "hello_world";
          m1(a);
      }
  
      private static void m1(String a) {
          AccessController.doPrivileged((PrivilegedAction&lt;String&gt;) () -&gt; {
              System.out.println("blala " + a);
              return "abc";
          });
      }
  }
  </code></pre>
  
  <p>Try with a breakpoint in <code>System.out.println("blala " + a);</code> and after <code>return "abc"</code> and it always report the same error.</p>
  
  <p><img src="https://i.stack.imgur.com/mfquH.png" alt="enter image description here"></p>
  
  <p>I used <code>AccessController.doPrivileged</code> because it's what I used in my original code and of course i'm using Java 8.</p>
  
  <p>It says the same thing in <code>Watchers</code> and <code>Evaluate Expression</code>.</p>
  
  <p>I tried using the "anonymous  class" version and the debugger sees the value of <code>a</code> correctly</p>
  
  <p><img src="https://i.stack.imgur.com/BHIMD.png" alt="enter image description here"></p>
  
  <pre><code>private static void m1(String a) {
      AccessController.doPrivileged(new PrivilegedAction&lt;String&gt;() {
          @Override
          public String run() {
              System.out.println("blala " + a);
              return "abc";
          }
      });
  }
  </code></pre>
  
  <p>I'm missing something about lambda expressions or it's an IntellIJ IDEA 14 bug?</p>
  
  <p>I don't want to report the bug right now because I already reported a bug that was caused by my code instead of IntellIJ IDEA, so I want to be sure before do something (and because I don't use Java 8 so often, so I could be wrong).</p>