IDEA-190727 Replace instanceof with null-check could automatically eliminate double negation

This commit is contained in:
Tagir Valeev
2018-04-22 17:07:04 +07:00
parent d280c276f9
commit 53094fd2d2
3 changed files with 39 additions and 9 deletions
@@ -0,0 +1,10 @@
// "Replace with a null check" "true"
class Test {
void test(String s) {
Object obj = s;
if (obj == null) {
return;
}
System.out.println("always");
}
}
@@ -0,0 +1,10 @@
// "Replace with a null check" "true"
class Test {
void test(String s) {
Object obj = s;
if (!(obj inst<caret>anceof String)) {
return;
}
System.out.println("always");
}
}