Skip to content

Commit

Permalink
Merge branch '2.19'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 26, 2025
2 parents 81c04f0 + 60fbb91 commit c4406ec
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Project: jackson-databind
#4908: Deserialization behavior change with @JsonCreator and
@ConstructorProperties between 2.17 and 2.18
(reported by Gustavo B)
#4922: Failing `@JsonMerge` with a custom Map
(reported by @nlisker)
2.18.2 (27-Nov-2024)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package tools.jackson.databind.deser.merge;

import java.util.*;

import org.junit.jupiter.api.Test;

import com.fasterxml.jackson.annotation.JsonMerge;

import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.testutil.DatabindTestUtil;

import static org.junit.jupiter.api.Assertions.*;

@SuppressWarnings("serial")
public class CustomMapMerge4922Test
extends DatabindTestUtil
{
// [databind#4922]
interface MyMap4922<K, V> extends Map<K, V> {}

static class MapImpl<K, V> extends HashMap<K, V> implements MyMap4922<K, V> {}

static class MergeMap4922 {
@JsonMerge // either here
public MyMap4922<Integer, String> map = new MapImpl<>();
}

private final ObjectMapper MAPPER = newJsonMapper();

// [databind#4922]: Merge for custom maps fails
@Test
void testJDKMapperReading() throws Exception {
MergeMap4922 input = new MergeMap4922();
input.map.put(3, "ADS");

String json = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(input);
MergeMap4922 merge2 = MAPPER.readValue(json, MergeMap4922.class);
assertNotNull(merge2);
}

}

0 comments on commit c4406ec

Please sign in to comment.