lambda: do not suggest to replace with lambda when refs to final fields exist in body (IDEA-111026); final initializer

This commit is contained in:
anna
2013-10-24 14:07:46 +02:00
parent 0b790578ad
commit a7316ca594
5 changed files with 58 additions and 3 deletions
@@ -0,0 +1,11 @@
class MyTest {
final Runnable lambdaRunnable = () -> {
System.out.println(<error descr="Variable 'o' might not have been initialized">o</error>);
};
final Object o;
MyTest(Object o) {
this.o = o;
}
}
@@ -0,0 +1,15 @@
// "Replace with lambda" "false"
class MyTest {
final Runnable anonymRunnable = new Run<caret>nable() {
@Override
public void run() {
System.out.println(o);
}
};
final Object o;
MyTest(Object o) {
this.o = o;
}
}