Add a test for handling of "unknown type id"
diff --git a/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java b/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java
index ec6bbc0..fd69008 100644
--- a/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java
+++ b/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java
@@ -889,7 +889,12 @@
                 if (type.hasRawClass(Void.class)) {
                     return null;
                 }
-                return type;
+                // But ensure there's type compatibility
+                if (type.isTypeOrSubTypeOf(baseType.getRawClass())) {
+                    return type;
+                }
+                throw unknownTypeException(baseType, id,
+                        "problem handler tried to resolve into non-subtype: "+type);
             }
             h = h.next();
         }