// IDEA-191374 class B {} class A { private B b = new B(); void foo() { String s = b != null ? b.toString() : ""; //comment this line and the error will appear if (b instanceof B) { // no error reported here 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 (operands[0] instanceof Base) { System.out.println("always"); } } }