I noticed that when I hover over a local variable, when my debugger is stopped inside the lambda, it tells Cannot find local variable 'variable_name' , even if it is displayed inside the lambda and is used.
Code example
public class Main { public static void main(String[] args) { String a = "hello_world"; m1(a); } private static void m1(String a) { AccessController.doPrivileged((PrivilegedAction<String>) () -> { System.out.println("blala " + a); return "abc"; }); } }
Try with a breakpoint in System.out.println("blala " + a); and after return "abc" and always report the same error.

I used AccessController.doPrivileged because this is what I used in my source code, and of course I use Java 8.
He says the same thing in Watchers and Evaluate Expression .
I tried using the version of the โanonymous classโ, and the debugger correctly understood the value of a

private static void m1(String a) { AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { System.out.println("blala " + a); return "abc"; } }); }
Am I missing something about lambda expressions or is this an IntellIJ IDEA 14 error?
I donโt want to report an error right now, because I already reported an error caused by my code, not IntellIJ IDEA, so I want to be sure before I do something (and because I donโt use Java 8 so often , so I could be wrong).
source share