diff --git a/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java b/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java index 8697df110b..e2517e313e 100644 --- a/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java +++ b/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java @@ -838,11 +838,6 @@ public JsonSerializer findNullValueSerializer(BeanProperty property) * @param unknownType Type for which no serializer is found */ public JsonSerializer getUnknownTypeSerializer(Class unknownType) { - // 23-Apr-2015, tatu: Only return shared instance if nominal type is Object.class - if (unknownType == Object.class) { - return _unknownTypeSerializer; - } - // otherwise construct explicit instance with property handled type return new UnknownSerializer(unknownType); } diff --git a/src/test/java/com/fasterxml/jackson/databind/TestObjectMapperBeanDeserializer.java b/src/test/java/com/fasterxml/jackson/databind/TestObjectMapperBeanDeserializer.java index 6778274965..3380811dd7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/TestObjectMapperBeanDeserializer.java +++ b/src/test/java/com/fasterxml/jackson/databind/TestObjectMapperBeanDeserializer.java @@ -323,4 +323,11 @@ public void testUnknownFields() throws Exception ; } } + + public void testObject() throws Exception + { + MAPPER.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); + assertEquals(true, MAPPER.canSerialize(Object.class)); + assertEquals("{}", MAPPER.writeValueAsString(new Object())); + } }