Skip to content

Commit d515746

Browse files
authored
Merge branch '3.x' into test-scala3.8
2 parents 086d212 + 730bf06 commit d515746

16 files changed

Lines changed: 162 additions & 63 deletions

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ name: Continuous Integration
99

1010
on:
1111
pull_request:
12-
branches: [3.x, 3.0]
12+
branches: [3.x, 3.2, 3.1, 3.0]
1313
push:
14-
branches: [3.x, 3.0]
14+
branches: [3.x, 3.2, 3.1, 3.0]
1515
tags: [v*]
1616

1717
env:
@@ -68,7 +68,7 @@ jobs:
6868
run: tar cf targets.tar target project/target
6969

7070
- name: Upload target directories
71-
uses: actions/upload-artifact@v5
71+
uses: actions/upload-artifact@v7
7272
with:
7373
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
7474
path: targets.tar
@@ -117,7 +117,7 @@ jobs:
117117
uses: sbt/setup-sbt@v1
118118

119119
- name: Download target directories (2.12.21)
120-
uses: actions/download-artifact@v6
120+
uses: actions/download-artifact@v8
121121
with:
122122
name: target-${{ matrix.os }}-2.12.21-${{ matrix.java }}
123123

@@ -127,7 +127,7 @@ jobs:
127127
rm targets.tar
128128
129129
- name: Download target directories (2.13.18)
130-
uses: actions/download-artifact@v6
130+
uses: actions/download-artifact@v8
131131
with:
132132
name: target-${{ matrix.os }}-2.13.18-${{ matrix.java }}
133133

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Consult the [Scaladoc](https://fasterxml.github.io/jackson-module-scala/latest/a
103103

104104
To import in sbt:
105105
```scala
106-
libraryDependencies += "tools.jackson.module" %% "jackson-module-scala" % "3.0.0"
106+
libraryDependencies += "tools.jackson.module" %% "jackson-module-scala" % "3.1.2"
107107
```
108108

109109
## Java/Kotlin users

build.sbt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ ThisBuild / publishTo := {
2727
bomFormat := "xml"
2828

2929
resolvers += Resolver.sonatypeCentralSnapshots
30-
ThisBuild / version := "3.1.0-SNAPSHOT"
31-
val jacksonVersion = "3.1.0-SNAPSHOT"
30+
ThisBuild / version := "3.3.0-SNAPSHOT"
31+
val jacksonVersion = "3.3.0-SNAPSHOT"
3232

3333
autoAPIMappings := true
3434

@@ -121,10 +121,9 @@ else
121121
)
122122

123123
libraryDependencies ++= jacksonDependencies ++ Seq(
124-
"org.scala-lang.modules" %% "scala-java8-compat" % "1.0.2" % Test,
125124
"javax.ws.rs" % "javax.ws.rs-api" % "2.1.1" % Test,
126125
"io.swagger" % "swagger-core" % "1.6.8" % Test,
127-
"org.scalatest" %% "scalatest" % "3.2.19" % Test
126+
"org.scalatest" %% "scalatest" % "3.2.20" % Test
128127
)
129128

130129
// build.properties
@@ -140,7 +139,7 @@ Test / parallelExecution := false
140139
ThisBuild / githubWorkflowSbtCommand := "sbt -J-Xmx2G"
141140
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec(Zulu, "17"), JavaSpec(Zulu, "21"), JavaSpec(Zulu, "25"))
142141
ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("test", "mimaReportBinaryIssues")))
143-
ThisBuild / githubWorkflowTargetBranches := Seq("3.x", "3.0")
142+
ThisBuild / githubWorkflowTargetBranches := Seq("3.x", "3.2", "3.1", "3.0")
144143
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
145144
ThisBuild / githubWorkflowPublishTargetBranches :=
146145
Seq(

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.12.1
1+
sbt.version=1.12.11

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
88

99
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4")
1010

11-
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.29.0")
11+
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.30.0")
1212

1313
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
1414
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.1.0")

release-notes/VERSION.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
# Version: 2.22.0
2+
3+
This patch release tracks Jackson 2.22. The 2.22 series has full support for
4+
Scala 2.11, 2.12, 2.13 and 3.3+. Java 8 is the minimum supported Java version.
5+
There are no new fixes in this release.
6+
7+
# Version: 2.21.4
8+
9+
There are no new fixes in this release; it serves to track the 2.21.4 release
10+
of the upstream Jackson projects.
11+
12+
# Version: 2.21.3
13+
14+
There are no new fixes in this release; it serves to track the 2.21.3 release
15+
of the upstream Jackson projects.
16+
17+
# Version: 2.21.2
18+
19+
There are no new fixes in this release; it serves to track the 2.21.2 release
20+
of the upstream Jackson projects.
21+
22+
# Version: 2.21.1
23+
24+
There are no new fixes in this release; it serves to track the 2.21.1 release
25+
of the upstream Jackson projects.
26+
127
# Version: 2.21.0
228

329
This patch release tracks Jackson 2.21. The 2.21 series has full support for
@@ -58,6 +84,21 @@ Scala 2.11, 2.12, 2.13 and 3.3+. Java 8 is the minimum supported Java version.
5884
* [[gh-pr-713]](https://github.com/FasterXML/jackson-module-scala/pull/713) Add ScalaModule.builder() to over another way to customise the Scala module
5985
* [[gh-722]](https://github.com/FasterXML/jackson-module-scala/issues/722) Collection deserializer should create empty collection instead of null (when input is null)
6086

87+
# Version: 2.18.8
88+
89+
There are no new fixes in this release; it serves to track the 2.18.7 release
90+
of the upstream Jackson projects.
91+
92+
# Version: 2.18.7
93+
94+
There are no new fixes in this release; it serves to track the 2.18.7 release
95+
of the upstream Jackson projects.
96+
97+
# Version: 2.18.6
98+
99+
There are no new fixes in this release; it serves to track the 2.18.6 release
100+
of the upstream Jackson projects.
101+
61102
# Version: 2.18.5
62103

63104
There are no new fixes in this release; it serves to track the 2.18.5 release

release-notes/VERSION3.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
11
Check VERSION.md for jackson-module-scala 2.x release information. This file tracks jackson-module-scala 3.x.
22

3-
# 3.1.0-rc1
3+
# 3.2.0
44

5-
This patch release tracks Jackson 3.1.0-rc1. The 3.1 series has full support for Scala 2.12, 2.13 and 3.
5+
This patch release tracks Jackson 3.2.0. The 3.2 series has full support for Scala 2.12, 2.13 and 3.
6+
There are no new fixes in this release.
7+
8+
# 3.1.4
9+
10+
There are no new fixes in this release; it serves to track the 3.1.4 release
11+
of the upstream Jackson projects.
12+
13+
# 3.1.3
14+
15+
There are no new fixes in this release; it serves to track the 3.1.3 release
16+
of the upstream Jackson projects.
17+
18+
# 3.1.2
19+
20+
There are no new fixes in this release; it serves to track the 3.1.2 release
21+
of the upstream Jackson projects.
22+
23+
# 3.1.1
24+
25+
There are no new fixes in this release; it serves to track the 3.1.1 release
26+
of the upstream Jackson projects.
27+
28+
# 3.1.0
29+
30+
This patch release tracks Jackson 3.1.0. The 3.1 series has full support for Scala 2.12, 2.13 and 3.
631

732
* [[gh-787]](https://github.com/FasterXML/jackson-module-scala/issues/787) support JsonInclude filter for Scala collections
33+
* [[gh-pr-799]](https://github.com/FasterXML/jackson-module-scala/pull/799) Scala 3.8+ requires us to make an underlying field in a Scala 2 Enumeration class accessible
834

935
# 3.0.4
1036

@@ -31,6 +57,7 @@ of the upstream Jackson projects.
3157
# 3.0.0
3258

3359
This patch release tracks Jackson 3.0.0. The 3.0 series has full support for Scala 2.12, 2.13 and 3.
60+
Java 17 is the minimum supported version now (Jackson 3 generally has a minimum requirement of Java 17).
3461
There are many changes in related Jackson libraries that affect all Jackson users. jackson-module-scala changes
3562
are less significant. The most notable change is the addition of ScalaModule builder.
3663
Users who don't use DefaultScalaModule may need to change to using ScalaModule builder.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package tools.jackson.module.scala.deser
2+
3+
import com.fasterxml.jackson.annotation.JsonMerge
4+
import tools.jackson.core.`type`.TypeReference
5+
import tools.jackson.databind.{MapperFeature, ObjectMapper, ObjectReader}
6+
import tools.jackson.module.scala.DefaultScalaModule
7+
8+
import scala.collection.{Map, mutable}
9+
10+
class MergeScala2Test extends DeserializerTest {
11+
12+
val module: DefaultScalaModule.type = DefaultScalaModule
13+
14+
// This test relies on enabling MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS
15+
// which is not enabled by default in Jackson v2 but not in Jackson v3
16+
def newScalaMapper: ObjectMapper = newBuilder
17+
.enable(MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS)
18+
.build()
19+
20+
21+
val firstPairMapJson = """{"one":{"first":"1"},"two":{"second":"2"},"three":{"first":"3","second":"4"}}"""
22+
val secondPairMapJson = """{"two":{"first":"22"},"three":{"second":"33"}}"""
23+
val secondPairMap = Map("two" -> Pair("22", null), "three" -> Pair(null, "33"))
24+
val mergedPairMap = Map("one" -> Pair("1", null), "two" -> Pair("22", "2"), "three" -> Pair("3", "33"))
25+
26+
behavior of "The DefaultScalaModule when reading for updating"
27+
28+
// started failing in jackson-module-scala v3.2.0 but only for Scala 3
29+
// see https://github.com/FasterXML/jackson-module-scala/issues/817
30+
it should "merge only the annotated pair map" in {
31+
val typeReference = new TypeReference[ClassWithMaps[Pair]]{}
32+
val initial = deserialize(classJson(firstPairMapJson), typeReference)
33+
val result = updateValue(newScalaMapper, initial, typeReference, classJson(secondPairMapJson))
34+
35+
result shouldBe ClassWithMaps(secondPairMap, mergedPairMap)
36+
}
37+
38+
def classJson(nestedJson: String) = s"""{"field1":$nestedJson,"field2":$nestedJson}"""
39+
40+
private def updateValue[T](mapper: ObjectMapper, valueToUpdate: T,
41+
typeReference: TypeReference[T], src: String): T = {
42+
objectReaderFor(mapper, valueToUpdate, typeReference).readValue(src)
43+
}
44+
45+
private def objectReaderFor[T](mapper: ObjectMapper, valueToUpdate: T,
46+
typeReference: TypeReference[T]): ObjectReader = {
47+
mapper.readerForUpdating(valueToUpdate).forType(typeReference)
48+
}
49+
}

src/test/scala/tools/jackson/module/scala/deser/CaseObjectDeserializerTest.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import tools.jackson.databind.json.JsonMapper
88
import tools.jackson.module.scala.{ClassTagExtensions, DefaultScalaModule}
99
import tools.jackson.module.scala.introspect.ScalaAnnotationIntrospectorModule
1010

11-
import scala.compat.java8.FunctionConverters.asJavaUnaryOperator
12-
1311
object CaseObjectDeserializerTest {
1412
case object TestObject
1513

@@ -51,11 +49,11 @@ class CaseObjectDeserializerTest extends DeserializerTest {
5149

5250
it should "deserialize Foo and not create a new instance (visibility settings)" in {
5351
val mapper = newBuilder
54-
.changeDefaultVisibility(asJavaUnaryOperator((a: Any) => {
52+
.changeDefaultVisibility(_ => {
5553
VisibilityChecker.defaultInstance()
5654
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
5755
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
58-
}))
56+
})
5957
.build()
6058
val original = Foo
6159
val json = mapper.writeValueAsString(original)

src/test/scala/tools/jackson/module/scala/deser/MergeTest.scala

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class MergeTest extends DeserializerTest {
1717

1818
val module: DefaultScalaModule.type = DefaultScalaModule
1919

20-
// This test replies on enabling MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS
21-
// which is not enabled by default in the Jackson v2 but not in Jackson v3
20+
// This test relies on enabling MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS
21+
// which is not enabled by default in Jackson v2 but not in Jackson v3
2222
def newScalaMapper: ObjectMapper = newBuilder
2323
.enable(MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS)
2424
.build()
@@ -28,6 +28,21 @@ class MergeTest extends DeserializerTest {
2828
.defaultMergeable(true)
2929
.build()
3030

31+
val firstListJson = """["one","two"]"""
32+
val secondListJson = """["three"]"""
33+
val secondList = List("three")
34+
val mergedList = List("one", "two", "three")
35+
36+
val firstStringMapJson = """{"one":"1","two":"2"}"""
37+
val secondStringMapJson = """{"two":"22","three":"33"}"""
38+
val secondStringMap = Map("two" -> "22", "three" -> "33")
39+
val mergedStringMap = Map("one" -> "1", "two" -> "22", "three" -> "33")
40+
41+
val firstPairMapJson = """{"one":{"first":"1"},"two":{"second":"2"},"three":{"first":"3","second":"4"}}"""
42+
val secondPairMapJson = """{"two":{"first":"22"},"three":{"second":"33"}}"""
43+
val secondPairMap = Map("two" -> Pair("22", null), "three" -> Pair(null, "33"))
44+
val mergedPairMap = Map("one" -> Pair("1", null), "two" -> Pair("22", "2"), "three" -> Pair("3", "33"))
45+
3146
behavior of "The DefaultScalaModule when reading for updating"
3247

3348
it should "merge both lists" in {
@@ -69,15 +84,7 @@ class MergeTest extends DeserializerTest {
6984

7085
result shouldBe ClassWithMaps(mergedPairMap, mergedPairMap)
7186
}
72-
73-
it should "merge only the annotated pair map" in {
74-
val typeReference = new TypeReference[ClassWithMaps[Pair]]{}
75-
val initial = deserialize(classJson(firstPairMapJson), typeReference)
76-
val result = updateValue(newScalaMapper, initial, typeReference, classJson(secondPairMapJson))
77-
78-
result shouldBe ClassWithMaps(secondPairMap, mergedPairMap)
79-
}
80-
87+
8188
it should "merge both mutable maps" in {
8289
val typeReference = new TypeReference[ClassWithMutableMaps[String]]{}
8390
val initial = deserialize(classJson(firstStringMapJson), typeReference)
@@ -94,22 +101,7 @@ class MergeTest extends DeserializerTest {
94101
result shouldBe ClassWithMutableMaps(mutable.Map() ++ secondStringMap, mutable.Map() ++ mergedStringMap)
95102
}
96103

97-
def classJson(nestedJson: String) = s"""{"field1":$nestedJson,"field2":$nestedJson}"""
98-
99-
val firstListJson = """["one","two"]"""
100-
val secondListJson = """["three"]"""
101-
val secondList = List("three")
102-
val mergedList = List("one", "two", "three")
103-
104-
val firstStringMapJson = """{"one":"1","two":"2"}"""
105-
val secondStringMapJson = """{"two":"22","three":"33"}"""
106-
val secondStringMap = Map("two" -> "22", "three" -> "33")
107-
val mergedStringMap = Map("one" -> "1", "two" -> "22", "three" -> "33")
108-
109-
val firstPairMapJson = """{"one":{"first":"1"},"two":{"second":"2"},"three":{"first":"3","second":"4"}}"""
110-
val secondPairMapJson = """{"two":{"first":"22"},"three":{"second":"33"}}"""
111-
val secondPairMap = Map("two" -> Pair("22", null), "three" -> Pair(null, "33"))
112-
val mergedPairMap = Map("one" -> Pair("1", null), "two" -> Pair("22", "2"), "three" -> Pair("3", "33"))
104+
private def classJson(nestedJson: String) = s"""{"field1":$nestedJson,"field2":$nestedJson}"""
113105

114106
private def updateValue[T](mapper: ObjectMapper, valueToUpdate: T,
115107
typeReference: TypeReference[T], src: String): T = {

0 commit comments

Comments
 (0)