mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
"might not have been initialized" adjusted for lambdas inside anonymous (IDEA-130468)
This commit is contained in:
+66
@@ -0,0 +1,66 @@
|
||||
class Test {
|
||||
final Runnable runnable;
|
||||
|
||||
{
|
||||
runnable = () -> System.out.println(<error descr="Variable 'runnable' might not have been initialized">runnable</error>);
|
||||
}
|
||||
|
||||
final Runnable runnable1;
|
||||
{
|
||||
runnable1 = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println(runnable1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
abstract class TestInnerAnonymous {
|
||||
|
||||
|
||||
void foo() {
|
||||
new Object() {
|
||||
final Runnable runnable;
|
||||
|
||||
{
|
||||
runnable = () -> System.out.println(<error descr="Variable 'runnable' might not have been initialized">runnable</error>);
|
||||
}
|
||||
|
||||
final Runnable runnable1;
|
||||
|
||||
{
|
||||
runnable1 = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println(runnable1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private static class MyObject {
|
||||
final Runnable runnable;
|
||||
|
||||
{
|
||||
runnable = () -> System.out.println(<error descr="Variable 'runnable' might not have been initialized">runnable</error>);
|
||||
}
|
||||
|
||||
final Runnable runnable1;
|
||||
|
||||
{
|
||||
runnable1 = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println(runnable1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -39,6 +39,10 @@ public class LightAdvHighlightingJdk8Test extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFinalVariableMightNotHaveBeenInitializedInsideLambda() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", true, false);
|
||||
|
||||
Reference in New Issue
Block a user