diff --git a/pom.xml b/pom.xml
index aa9b960479..9b9972e1ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,6 +101,12 @@ javax.xml.datatype, javax.xml.namespace, javax.xml.parsers
0.9.2
test
+
+ com.google.guava
+ guava
+ 18.0
+ test
+
diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java b/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java
index 8a737aade0..e1c5d47029 100644
--- a/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java
+++ b/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java
@@ -1387,16 +1387,23 @@ private KeyDeserializer _createEnumKeyDeserializer(DeserializationContext ctxt,
throws JsonMappingException
{
final DeserializationConfig config = ctxt.getConfig();
+ Class> enumClass = type.getRawClass();
+
BeanDescription beanDesc = config.introspect(type);
- JsonDeserializer> des = findDeserializerFromAnnotation(ctxt, beanDesc.getClassInfo());
+ // 24-Sep-2015, bim: a key deserializer is the preferred thing.
+ KeyDeserializer des = findKeyDeserializerFromAnnotation(ctxt, beanDesc.getClassInfo());
if (des != null) {
- return StdKeyDeserializers.constructDelegatingKeyDeserializer(config, type, des);
- }
- Class> enumClass = type.getRawClass();
- // 23-Nov-2010, tatu: Custom deserializer?
- JsonDeserializer> custom = _findCustomEnumDeserializer(enumClass, config, beanDesc);
- if (custom != null) {
- return StdKeyDeserializers.constructDelegatingKeyDeserializer(config, type, custom);
+ return des;
+ } else {
+ // 24-Sep-2015, bim: if no key deser, look for enum deserializer first, then a plain deser.
+ JsonDeserializer> custom = _findCustomEnumDeserializer(enumClass, config, beanDesc);
+ if (custom != null) {
+ return StdKeyDeserializers.constructDelegatingKeyDeserializer(config, type, custom);
+ }
+ JsonDeserializer> valueDesForKey = findDeserializerFromAnnotation(ctxt, beanDesc.getClassInfo());
+ if (valueDesForKey != null) {
+ return StdKeyDeserializers.constructDelegatingKeyDeserializer(config, type, valueDesForKey);
+ }
}
EnumResolver enumRes = constructEnumResolver(enumClass, config, beanDesc.findJsonValueMethod());
@@ -1728,6 +1735,22 @@ protected JsonDeserializer