Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/mustBeFinalJava10/beforeIfVarNonDenotable2.java
Tagir Valeev 05e9197580 [java-intentions] PsiElementFactoryImpl.createVariableDeclarationStatement: use 'var' if non-denotable type is requested
Fixes IDEA-374601 Copy 'x' to effectively final variable breaks code when type is non-denotable

GitOrigin-RevId: 3b2d15f24b182ac3948ae3b5066c5e68c1c0bf5c
2025-06-17 18:17:52 +00:00

17 lines
302 B
Java

// "Copy 'x' to effectively final temp variable" "true-preview"
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();
};
}
}