From 270498cffba21ae79d3cee152a2b8f1ee1cff3d2 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Fri, 20 Dec 2019 15:04:52 -0800 Subject: [PATCH] Fix #2576 --- release-notes/VERSION-2.x | 3 +++ .../fasterxml/jackson/databind/ser/BeanSerializerFactory.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 01146d4409..4bbe29e224 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -20,6 +20,9 @@ Project: jackson-databind (reported by Greg A) #2567: Incorrect target type for arrays when providing nulls and nulls are disabled (reported by João G) +#2576: Fail to serialize `Enum` instance which includes a method override + as POJO (shape = Shape.OBJECT) + (reported by ylhuang-veeva@github) 2.10.1 (09-Nov-2019) diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java b/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java index 984dbeadca..79c9a96f03 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java @@ -278,8 +278,8 @@ public JsonSerializer findBeanOrAddOnSerializer(SerializerProvider prov, // First things first: we know some types are not beans... if (!isPotentialBeanType(type.getRawClass())) { // 03-Aug-2012, tatu: Except we do need to allow serializers for Enums, - // as per [databind#24] - if (!type.isEnumType()) { + // as per [databind#24], [databind#2576] + if (!ClassUtil.isEnumType(type.getRawClass())) { return null; } }