Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/makeVarEffectivelyFinal/beforeIfVar.java
Tagir Valeev 0d5ea1d59e [java-intentions] Disable 'convert to if' when if-condition refers to the variable
Also: fix for var types
Fixes IDEA-374029 "Make effectively final" generates uncompilable code

GitOrigin-RevId: 17932aefe036dec167aabaf2066c4cdff11947da
2025-06-17 13:31:39 +00:00

10 lines
243 B
Java

// "Make 'x' effectively final by moving initializer to the 'if' statement" "true-preview"
class Abc {
void test() {
var x = 5;
if (Math.random() > 0.5) {
x = 10;
}
Runnable r = () -> System.out.println(<caret>x);
}
}