Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/afterLambda.java
Tagir Valeev 4a9b9b3cc2 [java-dfa] Remove useless fixes when value is known to be always null
Fixes IDEA-289497 'NullPointerException' recommendations contradiction

GitOrigin-RevId: 07be3f2ee5ce03bd7380b563806fcad03fb2a0f5
2022-03-03 10:49:26 +00:00

16 lines
365 B
Java

// "Assert 'container != null'" "true"
import java.util.function.Supplier;
class A{
void test(){
Object container = Math.random() > 0.5 ? "" : null;
Supplier<String> r = () -> {
if (Math.random() > 0.5) {
assert container != null;
return container.toString();
} else {
return "";
}
};
}
}