Skip to content

Commit 0f42bc9

Browse files
authored
Merge branch '2.x' into 2.x
2 parents ac1c279 + b056c49 commit 0f42bc9

File tree

8 files changed

+71
-12
lines changed

8 files changed

+71
-12
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727

2828
# Initializes the CodeQL tools for scanning.
2929
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.5
30+
uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
3131
with:
3232
languages: ${{ matrix.language }}
3333

3434
- name: Autobuild
35-
uses: github/codeql-action/autobuild@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.5
35+
uses: github/codeql-action/autobuild@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
3636

3737
- name: Perform CodeQL Analysis
38-
uses: github/codeql-action/analyze@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.5
38+
uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
run: ./mvnw -B -q -ff -ntp test
6666
- name: Publish code coverage
6767
if: ${{ matrix.release_build && github.event_name != 'pull_request' }}
68-
uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0
68+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
6969
with:
7070
token: ${{ secrets.CODECOV_TOKEN }}
7171
files: ./target/site/jacoco/jacoco.xml

.github/workflows/trigger_dep_builds_v2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
steps:
3838
- name: Repository dispatch
39-
uses: peter-evans/repository-dispatch@0ee9de00feb82e6165438c503f0bc29f628b8317 # v3.0.0
39+
uses: peter-evans/repository-dispatch@de78ac1a711fc6f29e77338f843065faf5335227 # v3.0.0
4040
with:
4141
token: ${{ secrets.token }}
4242
repository: ${{ matrix.repo }}

.github/workflows/trigger_dep_builds_v3.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
steps:
3737
- name: Repository dispatch
38-
uses: peter-evans/repository-dispatch@0ee9de00feb82e6165438c503f0bc29f628b8317 # v3.0.0
38+
uses: peter-evans/repository-dispatch@de78ac1a711fc6f29e77338f843065faf5335227 # v3.0.0
3939
with:
4040
token: ${{ secrets.token }}
4141
repository: ${{ matrix.repo }}

release-notes/VERSION-2.x

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Project: jackson-databind
66

77
2.21.0 (not yet released)
88

9+
#1547: Un-deprecate `SerializationFeature.WRITE_EMPTY_JSON_ARRAYS`
910
#5045: If there is a no-parameter constructor marked as `JsonCreator` and
1011
a constructor reported as `DefaultCreator`, latter is incorrectly used
1112
(reported by @wrongwrong)

src/main/java/com/fasterxml/jackson/databind/MappingJsonFactory.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
* The only addition to regular {@link JsonFactory} currently
1414
* is that {@link ObjectMapper} is constructed and passed as
1515
* the codec to use.
16+
*<p>
17+
* NOTE: this class is removed from Jackson 3.0 as it is no longer
18+
* needed (nor can implementation as-is be supported due to changes
19+
* in {@code JsonFactory}/{@code ObjectMapper} interfaces).
1620
*/
1721
public class MappingJsonFactory
1822
extends JsonFactory

src/main/java/com/fasterxml/jackson/databind/SerializationFeature.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,17 +355,18 @@ public enum SerializationFeature implements ConfigFeature
355355
* dynamically changed on per-call basis, because its effect is considered during
356356
* construction of serializers and property handlers.
357357
*<p>
358-
* Feature is enabled by default.
359-
*
360-
* @deprecated Since 2.8 there are better mechanism for specifying filtering; specifically
358+
* NOTE: Since 2.8 there are better mechanism for specifying filtering; specifically
361359
* using {@link com.fasterxml.jackson.annotation.JsonInclude} or configuration overrides.
360+
* This feature was deprecated from 2.8 through to 2.20 but no longer deprecated
361+
* since 2.21 / 3.0.
362+
*<p>
363+
* Feature is enabled by default.
362364
*/
363-
@Deprecated // since 2.8
364365
WRITE_EMPTY_JSON_ARRAYS(true),
365366

366367
/**
367-
* Feature added for interoperability, to work with oddities of
368-
* so-called "BadgerFish" convention.
368+
* Feature added for inter-operability (originally to work with oddities of
369+
* so-called "BadgerFish" convention).
369370
* Feature determines handling of single element {@link java.util.Collection}s
370371
* and arrays: if enabled, {@link java.util.Collection}s and arrays that contain exactly
371372
* one element will be serialized as if that element itself was serialized.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.fasterxml.jackson.databind.tofix;
2+
3+
import com.fasterxml.jackson.databind.testutil.failure.JacksonTestFailureExpected;
4+
import org.junit.jupiter.api.Assertions;
5+
import org.junit.jupiter.api.Test;
6+
7+
import com.fasterxml.jackson.annotation.JsonInclude;
8+
import com.fasterxml.jackson.annotation.JsonValue;
9+
import com.fasterxml.jackson.databind.ObjectMapper;
10+
import com.fasterxml.jackson.databind.cfg.MutableConfigOverride;
11+
12+
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_DEFAULT;
13+
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
14+
15+
// [databind#5312] Include.NON_DEFAULT regression for objects with @JsonValue
16+
public class JsonIncludeNonDefaultOnRecord5312Test
17+
{
18+
record StringValue(String value) {
19+
@Override
20+
@JsonValue
21+
public String value() {
22+
return value;
23+
}
24+
}
25+
26+
record Pojo1(StringValue value) { }
27+
28+
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
29+
record Pojo2(StringValue value) { }
30+
31+
record Pojo3(@JsonInclude(JsonInclude.Include.NON_DEFAULT) StringValue value) { }
32+
33+
34+
@JacksonTestFailureExpected
35+
@Test
36+
void testSerialization()
37+
throws Exception
38+
{
39+
ObjectMapper objectMapper = new ObjectMapper();
40+
objectMapper.setSerializationInclusion(NON_DEFAULT);
41+
42+
//might be relevant for analysis, but does not affect test outcome
43+
MutableConfigOverride objectStringConfigOverride = objectMapper.configOverride(String.class);
44+
objectStringConfigOverride.setIncludeAsProperty(JsonInclude.Value.construct(NON_NULL, NON_NULL));
45+
46+
//FAIL on jackson 2.18.2 / 2.20.0
47+
Assertions.assertEquals("{\"value\":\"\"}", objectMapper.writeValueAsString(new Pojo1(new StringValue(""))));
48+
//PASS
49+
Assertions.assertEquals("{\"value\":\"\"}", objectMapper.writeValueAsString(new Pojo2(new StringValue(""))));
50+
//FAIL on jackson 2.18.2 / 2.20.0
51+
Assertions.assertEquals("{\"value\":\"\"}", objectMapper.writeValueAsString(new Pojo3(new StringValue(""))));
52+
}
53+
}

0 commit comments

Comments
 (0)