Skip to content

Commit 8dd6e22

Browse files
authored
Merge pull request #257 from ProjectMapK/develop
Release 2024-12-29 11:02:56 +0000
2 parents bd35bb8 + 87ad105 commit 8dd6e22

File tree

12 files changed

+101
-28
lines changed

12 files changed

+101
-28
lines changed

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
8+
updates:
9+
- package-ecosystem: "gradle"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
# Friday 19:00 JST
14+
day: "saturday"
15+
time: "04:00"
16+
groups:
17+
dependencies:
18+
patterns:
19+
- "*"
20+
ignore:
21+
# The version of Kotlin is fixed to the lowest, so it is not subject to automatic updates
22+
- dependency-name: "kotlin"
23+
- dependency-name: "kotlinx-metadata-jvm"
24+
# linter is not subject to automatic renewal as it will be migrated to detekt in the future
25+
- dependency-name: "org.jmailen.kotlinter"

.github/workflows/test-main.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ jobs:
3838
java-version: [ '8', '11', '17', '21', '23' ]
3939
# Minimum version, latest release version, latest pre-release version (if exists)
4040
kotlin:
41-
- name: '1.8.22'
42-
version: '1.8.22'
43-
k2: false
4441
- name: '1.9.25'
4542
version: '1.9.25'
4643
k2: false
@@ -53,9 +50,9 @@ jobs:
5350
- name: '2.0.21 K2'
5451
version: '2.0.21'
5552
k2: true
56-
- name: '2.1.0-RC'
53+
- name: '2.1.0-RC2'
5754
k2: false
58-
- name: '2.1.0-RC K2'
55+
- name: '2.1.0-RC2 K2'
5956
k2: true
6057
env:
6158
KOTLIN_VERSION: ${{ matrix.kotlin.version }}

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Details are summarized in [KogeraSpecificImplementations](./docs/KogeraSpecificI
3232
# Compatibility
3333
- `jackson 2.18.x`
3434
- `Java 8+`
35-
- `Kotlin 1.8.22+`
35+
- `Kotlin 1.9.25+`
3636

3737
## About compatibility checks
3838
Compatibility checks for `Java` and `Kotlin` are done by `CI` grid tests.

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ val jacksonVersion = libs.versions.jackson.get()
1616
val generatedSrcPath = "${layout.buildDirectory.get()}/generated/kotlin"
1717

1818
group = groupStr
19-
version = "${jacksonVersion}-beta15"
19+
version = "${jacksonVersion}-beta16"
2020

2121
repositories {
2222
mavenCentral()

docs/FixedIssues.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ A list of issues that have not been resolved in `jackson-module-kotlin`, but hav
22

33
## Fixed
44
- [Getting MismatchedInputException instead of MissingKotlinParameterException · Issue \#234](https://github.com/FasterXML/jackson-module-kotlin/issues/234)
5-
- [Private getter with different return type hides property · Issue \#341](https://github.com/FasterXML/jackson-module-kotlin/issues/341)
65
- [Remove \`kotlin\-reflect\` and replace it with \`kotlinx\-metadata\-jvm\` · Issue \#450](https://github.com/FasterXML/jackson-module-kotlin/issues/450)
76
- [Annotation given to constructor parameters containing \`value class\` as argument does not work · Issue \#651](https://github.com/FasterXML/jackson-module-kotlin/issues/651)
87
- [How to deserialize a kotlin\.ranges\.ClosedRange<T> with Jackson · Issue \#663](https://github.com/FasterXML/jackson-module-kotlin/issues/663)

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[versions]
2-
kotlin = "1.8.22" # Mainly for CI, it can be rewritten by environment variable.
3-
jackson = "2.18.1"
2+
kotlin = "1.9.25" # Mainly for CI, it can be rewritten by environment variable.
3+
jackson = "2.18.2"
44

55
# test libs
6-
junit = "5.11.3"
6+
junit = "5.11.4"
77

88
[libraries]
99
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib" }
@@ -16,7 +16,7 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect" }
1616
junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
1717
junit-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" }
1818
junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }
19-
mockk = "io.mockk:mockk:1.13.13"
19+
mockk = "io.mockk:mockk:1.13.14"
2020
jackson-xml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-xml", version.ref = "jackson" }
2121
jackson-jsr310 = { module = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310", version.ref = "jackson" }
2222

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinFeature.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public enum class KotlinFeature(internal val enabledByDefault: Boolean) {
8989

9090
public companion object {
9191
internal val defaults
92-
get() = values().fold(BitSet(Int.SIZE_BITS)) { acc, cur ->
92+
get() = entries.fold(BitSet(Int.SIZE_BITS)) { acc, cur ->
9393
acc.apply { if (cur.enabledByDefault) this.or(cur.bitSet) }
9494
}
9595
}

src/test/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinModuleTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class KotlinModuleTest {
1515
@Test
1616
fun setKotlinFeatureTest() {
1717
val builder = KotlinModule.Builder().apply {
18-
KotlinFeature.values().forEach { enable(it) }
18+
KotlinFeature.entries.forEach { enable(it) }
1919
}
2020

2121
assertTrue(builder.isEnabled(KotlinFeature.NullToEmptyCollection))
@@ -27,7 +27,7 @@ class KotlinModuleTest {
2727
assertTrue(builder.isEnabled(KotlinFeature.UseJavaDurationConversion))
2828

2929
builder.apply {
30-
KotlinFeature.values().forEach { disable(it) }
30+
KotlinFeature.entries.forEach { disable(it) }
3131
}
3232

3333
assertFalse(builder.isEnabled(KotlinFeature.NullToEmptyCollection))
@@ -84,7 +84,7 @@ class KotlinModuleTest {
8484
val module = KotlinModule.Builder().apply {
8585
withCacheSize(KotlinModule.CacheSize(123, 321))
8686

87-
KotlinFeature.values().forEach {
87+
KotlinFeature.entries.forEach {
8888
configure(it, enabled)
8989
}
9090
}.build()

src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zIntegration/deser/FailNullForPrimitiveTest.kt

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,42 @@ import org.junit.jupiter.api.Test
99
import org.junit.jupiter.api.assertThrows
1010

1111
private class FailNullForPrimitiveTest {
12-
data class Dto(
12+
val mapper = jacksonObjectMapper()
13+
.enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
14+
15+
data class NoDefaultValue(
1316
val foo: Int,
1417
val bar: Int?
1518
)
1619

1720
@Test
18-
fun test() {
19-
val mapper = jacksonObjectMapper()
20-
.enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)
21+
fun noDefaultValueTest() {
22+
// If no default value is set, it will fail if undefined or null is entered
23+
assertThrows<MismatchedInputException> {
24+
mapper.readValue<NoDefaultValue>("{}")
25+
}
2126

2227
assertThrows<MismatchedInputException> {
23-
mapper.readValue<Dto>("{}")
28+
mapper.readValue<NoDefaultValue>("""{"foo":null}""")
2429
}
2530

31+
assertEquals(NoDefaultValue(0, null), mapper.readValue<NoDefaultValue>("""{"foo":0}"""))
32+
}
33+
34+
data class HasDefaultValue(
35+
val foo: Int = -1,
36+
val bar: Int? = -1
37+
)
38+
39+
@Test
40+
fun hasDefaultValueTest() {
41+
// If a default value is set, an input of undefined will succeed, but null will fail
42+
assertEquals(HasDefaultValue(-1, -1), mapper.readValue<HasDefaultValue>("{}"))
43+
2644
assertThrows<MismatchedInputException> {
27-
mapper.readValue<Dto>("""{"foo":null}""")
45+
mapper.readValue<HasDefaultValue>("""{"foo":null}""")
2846
}
2947

30-
assertEquals(Dto(0, null), mapper.readValue<Dto>("""{"foo":0}"""))
48+
assertEquals(HasDefaultValue(0, null), mapper.readValue<HasDefaultValue>("""{"foo":0, "bar":null}"""))
3149
}
3250
}

0 commit comments

Comments
 (0)