Skip to content

Commit 23a7332

Browse files
committed
Fix #1506
1 parent d44600d commit 23a7332

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

release-notes/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Project: jackson-databind
2020
(reported by Dmitry S)
2121
#1476: Wrong constructor picked up when deserializing object
2222
(reported by laurentgo@github)
23+
#1506: Missing `KeyDeserializer` for `CharSequence`
2324

2425
2.7.8 (26-Sep-2016)
2526

src/main/java/com/fasterxml/jackson/databind/deser/std/StdKeyDeserializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static StdKeyDeserializer forType(Class<?> raw)
7272
int kind;
7373

7474
// first common types:
75-
if (raw == String.class || raw == Object.class) {
75+
if (raw == String.class || raw == Object.class || raw == CharSequence.class) {
7676
return StringKD.forType(raw);
7777
} else if (raw == UUID.class) {
7878
kind = TYPE_UUID;

src/test/java/com/fasterxml/jackson/databind/deser/TestMapDeserialization.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,15 @@ public void testClassKeyMap() throws Exception {
501501
assertEquals(1, map.size());
502502
assertEquals("foo", map.get(String.class));
503503
}
504-
504+
505+
public void testcharSequenceKeyMap() throws Exception {
506+
String JSON = aposToQuotes("{'a':'b'}");
507+
Map<CharSequence,String> result = MAPPER.readValue(JSON, new TypeReference<Map<CharSequence,String>>() { });
508+
assertNotNull(result);
509+
assertEquals(1, result.size());
510+
assertEquals("b", result.get("a"));
511+
}
512+
505513
/*
506514
/**********************************************************
507515
/* Test methods, annotated Maps

0 commit comments

Comments
 (0)