Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/makeVarEffectivelyFinal/beforeIfVarNonDenotable.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

17 lines
322 B
Java

// "Make 'x' effectively final by moving initializer to the 'if' statement" "false"
class Abc {
interface A{}
interface B{
void m();
}
void test(Object obj) {
var x = (A & B) obj;
if (Math.random() > 0.5) {
x = null;
}
Runnable r = () -> {
if (<caret>x != null) x.m();
};
}
}