Got any code like this?
Certainly the JDK does - at least, in JDK 1.4.2,
PlainSocketImpl.java has a bunch of these.
instanceof expressions return
false if the value of the relational expression is null (see JLS 2nd Ed, 15.20.2), you can simply reduce that code to:
Here's how the bytecode looks with the unnecessary null check:
and without it:
A nice little savings there - so your classfiles get smaller and your code runs a bit faster!