Patch Set 4:

What you says is true for the code flow, but you have to declare the variable and do the instanceof check in the code anyway. Compared to that, duplicate code is worse in my personal opinion.