mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 15:41:26 +07:00
show error if uninitialized field is referenced from lambda inside inner/anonymous class in another field initializer; disable anonymous -> lambda for such places
This commit is contained in:
+25
@@ -64,3 +64,28 @@ abstract class TestInnerAnonymous {
|
||||
}
|
||||
}
|
||||
|
||||
interface Fun<A, B> {
|
||||
B m(A a);
|
||||
}
|
||||
|
||||
class TestAnonymousWithRefToTheTopLevelUninitializedField {
|
||||
private final int myId;
|
||||
|
||||
private Runnable r = new Runnable() {
|
||||
final int localId;
|
||||
{
|
||||
localId = 0;
|
||||
}
|
||||
|
||||
Fun<Integer, Integer> ff = (a) -> <error descr="Variable 'myId' might not have been initialized">myId</error>;
|
||||
Fun<Integer, Integer> ffLocal = (a) -> localId;
|
||||
public void run() {
|
||||
}
|
||||
};
|
||||
|
||||
public TestAnonymousWithRefToTheTopLevelUninitializedField(int id) {
|
||||
myId = id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user