diff options
Diffstat (limited to 'java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/EffectiveFinal.java')
-rw-r--r-- | java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/EffectiveFinal.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/EffectiveFinal.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/EffectiveFinal.java index 92b268394994..001b1f39c494 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/EffectiveFinal.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/EffectiveFinal.java @@ -142,3 +142,37 @@ class IDEA128196 { new Thread(() -> System.out.println(value)); } } + +class FinalAssignmentInInitializer { + private final String x; + { + Runnable r = () -> <error descr="Cannot assign a value to final variable 'x'">x</error> = ""; + x = ""; + } +} + +class AssignmentToFinalInsideLambda { + boolean isTrue() { + return true; + } + + Runnable r = () -> { + final int i; + if (isTrue()) { + i = 1; + } else { + i = 0; + } + }; + + void a() { + Runnable r = () -> { + final int i; + if (isTrue()) { + i = 1; + } else { + i = 0; + } + }; + } +}
\ No newline at end of file |