Skip to content

Commit 9c77088

Browse files
committed
SetMultimap should be deserialized to a LinkedHashMultimap by default
1 parent 9c4263d commit 9c77088

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

guava/src/main/java/com/fasterxml/jackson/datatype/guava/GuavaDeserializers.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type,
247247
}
248248

249249
// TODO: Remove the default fall-through once all implementations are covered.
250-
return new HashMultimapDeserializer(type, keyDeserializer, elementTypeDeserializer,
250+
return new LinkedHashMultimapDeserializer(type, keyDeserializer, elementTypeDeserializer,
251251
elementDeserializer);
252252
}
253253

guava/src/test/java/com/fasterxml/jackson/datatype/guava/TestMultimaps.java

+7
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,13 @@ public void testIssue67() throws IOException
319319
assertEquals(Maps.immutableEntry("a", 7), iterator.next());
320320
assertEquals(Maps.immutableEntry("a", 8), iterator.next());
321321
}
322+
323+
// [Issue#25]
324+
public void testDefaultSetMultiMap() throws IOException {
325+
@SuppressWarnings("unchecked")
326+
SetMultimap<String, String> map = (SetMultimap<String, String>) MAPPER.readValue(STRING_STRING_MULTIMAP, new TypeReference<SetMultimap>() {});
327+
assertTrue(map instanceof LinkedHashMultimap);
328+
}
322329

323330
public void testPolymorphicValue() throws IOException {
324331
ImmutableMultimapWrapper input = new ImmutableMultimapWrapper(ImmutableMultimap.of("add", new AddOp(3, 2), "mul", new MulOp(4, 6)));

0 commit comments

Comments
 (0)