Skip to content

Commit 56356fe

Browse files
committed
Update release notes wrt #3133 fix
1 parent 556a5bb commit 56356fe

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

release-notes/VERSION-2.x

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Not yet released
88

99
#1172: `@JsonView` doesn't work with `@JsonCreator`
1010
(reported by Dmitry B)
11+
#3133: Map deserialization results in different numeric classes based on
12+
json ordering (BigDecimal / Double) when used in combination with @JsonSubTypes
13+
(reported by @mreiterer)
1114
#4185: `@JsonIgnoreProperties` with `@JsonTypeInfo(include = JsonTypeInfo.As.EXTERNAL_PROPERTY)`
1215
does not work
1316
(reported by @jonasho)

src/test/java/com/fasterxml/jackson/databind/deser/jdk/BigDecimalForFloatDisabled3133Test.java renamed to src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/BigDecimalForFloatDisabled3133Test.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
package com.fasterxml.jackson.databind.deser.jdk;
1+
package com.fasterxml.jackson.databind.jsontype.jdk;
2+
3+
import static com.fasterxml.jackson.databind.BaseMapTest.jsonMapperBuilder;
4+
import static com.fasterxml.jackson.databind.BaseTest.a2q;
25

36
import java.util.HashMap;
47
import java.util.Map;
@@ -10,9 +13,6 @@
1013
import org.junit.jupiter.api.Assertions;
1114
import org.junit.jupiter.api.Test;
1215

13-
import static com.fasterxml.jackson.databind.BaseMapTest.jsonMapperBuilder;
14-
import static com.fasterxml.jackson.databind.BaseTest.a2q;
15-
1616
/**
1717
* Unit test proving that below issue is fixed.
1818
* <p>
@@ -27,11 +27,11 @@ public class BigDecimalForFloatDisabled3133Test
2727
property = "type")
2828

2929
@JsonSubTypes({
30-
@JsonSubTypes.Type(value = TestMapContainer.class, name = "MAP"),
30+
@JsonSubTypes.Type(value = TestMapContainer3133.class, name = "MAP"),
3131
})
32-
interface TestJsonTypeInfoInterface { }
32+
interface BaseType3133 { }
3333

34-
static class TestMapContainer implements TestJsonTypeInfoInterface {
34+
static class TestMapContainer3133 implements BaseType3133 {
3535

3636
private Map<String, ? extends Object> map = new HashMap<>();
3737

@@ -48,16 +48,18 @@ public void setMap(Map<String, ? extends Object> map) {
4848
.disable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)
4949
.build();
5050

51+
// [databind#3133]
5152
@Test
52-
public void testDeserializeWithDifferentOrdering() throws Exception {
53+
public void testDeserializeWithDifferentOrdering3133() throws Exception
54+
{
5355
// case 1 : type first
5456
String ordering1 = a2q("{'type': 'MAP','map': { 'doubleValue': 0.1 }}");
55-
TestMapContainer model1 = mapper.readValue(ordering1, TestMapContainer.class);
57+
TestMapContainer3133 model1 = mapper.readValue(ordering1, TestMapContainer3133.class);
5658
Assertions.assertTrue(model1.getMap().get("doubleValue") instanceof Double);
5759

5860
// case 2 : value first
5961
String ordering2 = a2q("{'map': { 'doubleValue': 0.1 }, 'type': 'MAP'}");
60-
TestMapContainer model2 = mapper.readValue(ordering2, TestMapContainer.class);
62+
TestMapContainer3133 model2 = mapper.readValue(ordering2, TestMapContainer3133.class);
6163
Assertions.assertTrue(model2.getMap().get("doubleValue") instanceof Double);
6264
}
6365
}

0 commit comments

Comments
 (0)