Skip to content

Commit 55a50dd

Browse files
committed
Merge branch '2.12'
2 parents 8471681 + 170c6d4 commit 55a50dd

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

release-notes/VERSION-2.x

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Project: jackson-databind
2424
values could be converted to integers losslessly
2525
(requested by Oguzhan U; implementation contributed by Siavash S)
2626
#2903: Allow preventing "Enum from integer" coercion using new `CoercionConfig` system
27+
#2909: `@JsonValue` not considered when evaluating inclusion
28+
(reported by chrylis@github)
2729

2830
2.12.0-rc1 (12-Oct-2020)
2931

src/main/java/com/fasterxml/jackson/databind/ser/BeanPropertyWriter.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,8 @@ public void serializeAsElement(Object bean, JsonGenerator gen,
720720
serializeAsPlaceholder(bean, gen, prov);
721721
return;
722722
}
723-
} else if (_suppressableValue.equals(value)) { // can NOT suppress
724-
// entries in tabular
725-
// output
723+
} else if (_suppressableValue.equals(value)) {
724+
// can NOT suppress entries in tabular output
726725
serializeAsPlaceholder(bean, gen, prov);
727726
return;
728727
}

src/main/java/com/fasterxml/jackson/databind/ser/std/ObjectArraySerializer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public ObjectArraySerializer(ObjectArraySerializer src, TypeSerializer vts)
6666
_staticTyping = src._staticTyping;
6767
_elementSerializer = src._elementSerializer;
6868
}
69-
69+
7070
@SuppressWarnings("unchecked")
7171
public ObjectArraySerializer(ObjectArraySerializer src,
7272
BeanProperty property, TypeSerializer vts, JsonSerializer<?> elementSerializer,

src/test/java/com/fasterxml/jackson/databind/deser/creators/TestPolymorphicDelegating.java

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public void testAbstractDelegateWithCreator() throws Exception
4242
Issue580Bean input = new Issue580Bean(new Issue580Impl(13));
4343
ObjectMapper mapper = new ObjectMapper();
4444
String json = mapper.writeValueAsString(input);
45-
4645
Issue580Bean result = mapper.readValue(json, Issue580Bean.class);
4746
assertNotNull(result);
4847
assertNotNull(result.value);

src/test/java/com/fasterxml/jackson/databind/ser/filter/MapInclusionTest.java

+18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.*;
55

66
import com.fasterxml.jackson.annotation.JsonInclude;
7+
import com.fasterxml.jackson.annotation.JsonValue;
78
import com.fasterxml.jackson.databind.*;
89

910
public class MapInclusionTest extends BaseMapTest
@@ -41,6 +42,17 @@ public NoNullsNotEmptyMapContainer add(String key, String value) {
4142
}
4243
}
4344

45+
// [databind#2909]
46+
static class Wrapper2909 {
47+
@JsonValue
48+
public Map<String, String> values = new HashMap<>();
49+
}
50+
51+
static class TopLevel2099 {
52+
@JsonInclude(JsonInclude.Include.NON_EMPTY)
53+
public Wrapper2909 nested = new Wrapper2909();
54+
}
55+
4456
/*
4557
/**********************************************************
4658
/* Test methods
@@ -80,4 +92,10 @@ public void testNonEmptyNoNullsMap() throws IOException
8092
.add("b", null));
8193
assertEquals(aposToQuotes("{}"), json);
8294
}
95+
96+
// [databind#2909]
97+
public void testMapViaJsonValue() throws Exception
98+
{
99+
assertEquals(a2q("{}"), MAPPER.writeValueAsString(new TopLevel2099()));
100+
}
83101
}

0 commit comments

Comments
 (0)