Make a better decision about which class to choose when in mixed mode by
comparing the type and name rather than just picking the first from the
list of possibilities. It still does that as a fallback, although it
will also have tried the namespace as well by then.