IDEA-209947 Explanation for always failing call

GitOrigin-RevId: 9236c7ce5db9a27f0b2c793f54e500d6ef64d78c
This commit is contained in:
Tagir Valeev
2019-05-08 13:05:29 +03:00
committed by intellij-monorepo-bot
parent fb79b6d617
commit 4fb16241d8
4 changed files with 46 additions and 5 deletions
@@ -0,0 +1,21 @@
/*
Call always fails (foo(s, "checked"); line#12)
According to inferred contract, method 'foo' throws exception when obj == null (foo; line#12)
Condition 's == null' was checked before (s == null; line#11)
*/
import java.util.Objects;
class Test {
void test(String s) {
if (s == null) {
<selection>foo(s, "checked")</selection>;
}
}
static void foo(Object obj, String message) {
if(obj == null) {
throw new RuntimeException(message);
}
}
}