isEffectivelyFinal: disallow effectively final variables to be initialized twice (IDEA-165060)

This commit is contained in:
Anna.Kozlova
2016-12-06 17:19:20 +01:00
parent dff2942958
commit e55fbf3f1d
3 changed files with 38 additions and 7 deletions

View File

@@ -175,4 +175,16 @@ class AssignmentToFinalInsideLambda {
}
};
}
}
class NonInitializedButWrittenTwice {
private void test(boolean b) {
int s;
if(b) {
s = 1;
J is = () -> <error descr="Variable used in lambda expression should be final or effectively final">s</error>;
System.out.println(is.m());
}
<error descr="Variable 's' might not have been initialized">s</error>++;
}
}