Check class of parent variable directly rather than using instanceof check. Needed to get correct behavior for subclasses of ClassHierarchyMethodTargetSelector