In Java, generic files can / should be used to reduce instanceof keywords. Thus, only those few that are unknown at compile time need to be checked. However, instanceof not like goto - it will not spoil your control flow much (although it introduces many additional variables if you are not careful).
I regularly use instanceof , but if there are a lot of them, I would think that this is the smell of code. The trick is to come up with something better; if you can, then using instanceof is probably wrong. I would not know about the scheme to make sure that it is useful or bad for general cases. The listing after instanceof probably hurts more than the keyword.
source share