Fix processing of instanceof on unknown variable (IDEA-191374)

This commit is contained in:
Tagir Valeev
2018-05-11 13:37:19 +07:00
parent 43c5e0c644
commit 40c1525959
2 changed files with 24 additions and 1 deletions
@@ -9,4 +9,24 @@ class A {
System.out.println(b);
}
}
interface Base {
void doSmth();
}
interface Sub extends Base {}
private static void test(Base[] operands) {
operands[0].doSmth();
if (operands[0] instanceof Sub) {
System.out.println("possible");
}
}
private static void test2(Sub[] operands) {
operands[0].doSmth();
if (<warning descr="Condition 'operands[0] instanceof Base' is always 'true'">operands[0] instanceof Base</warning>) {
System.out.println("always");
}
}
}