Starting to fix [JACKSON-756]
diff --git a/src/mapper/java/org/codehaus/jackson/map/deser/BasicDeserializerFactory.java b/src/mapper/java/org/codehaus/jackson/map/deser/BasicDeserializerFactory.java
index 691c287..6c9c6c0 100644
--- a/src/mapper/java/org/codehaus/jackson/map/deser/BasicDeserializerFactory.java
+++ b/src/mapper/java/org/codehaus/jackson/map/deser/BasicDeserializerFactory.java
@@ -267,7 +267,8 @@
if (contentDeser == null) { // not defined by annotation
// One special type: EnumSet:
if (EnumSet.class.isAssignableFrom(collectionClass)) {
- return new EnumSetDeserializer(constructEnumResolver(contentType.getRawClass(), config));
+ return new EnumSetDeserializer(contentType.getRawClass(),
+ createEnumDeserializer(config, p, contentType, property));
}
// But otherwise we can just use a generic value deserializer:
// 'null' -> collections have no referring fields
diff --git a/src/mapper/java/org/codehaus/jackson/map/deser/std/EnumSetDeserializer.java b/src/mapper/java/org/codehaus/jackson/map/deser/std/EnumSetDeserializer.java
index fa15ed2..76dba4e 100644
--- a/src/mapper/java/org/codehaus/jackson/map/deser/std/EnumSetDeserializer.java
+++ b/src/mapper/java/org/codehaus/jackson/map/deser/std/EnumSetDeserializer.java
@@ -7,6 +7,7 @@
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
import org.codehaus.jackson.map.TypeDeserializer;
import org.codehaus.jackson.map.util.EnumResolver;
@@ -26,17 +27,24 @@
{
protected final Class<Enum> _enumClass;
- protected final EnumDeserializer _enumDeserializer;
+ protected final JsonDeserializer<Enum<?>> _enumDeserializer;
@SuppressWarnings("unchecked" )
public EnumSetDeserializer(EnumResolver enumRes)
{
- super(EnumSet.class);
- _enumDeserializer = new EnumDeserializer(enumRes);
- // this is fugly, but not sure of a better way...
- _enumClass = (Class<Enum>) ((Class<?>) enumRes.getEnumClass());
+ // fugly, but what we can we do...
+ this((Class<Enum>) ((Class<?>) enumRes.getEnumClass()),
+ new EnumDeserializer(enumRes));
}
+ @SuppressWarnings("unchecked" )
+ public EnumSetDeserializer(Class<?> enumClass, JsonDeserializer<?> deser)
+ {
+ super(EnumSet.class);
+ _enumClass = (Class<Enum>) enumClass;
+ _enumDeserializer = (JsonDeserializer<Enum<?>>) deser;
+ }
+
@SuppressWarnings("unchecked")
@Override
public EnumSet<?> deserialize(JsonParser jp, DeserializationContext ctxt)