From efcbf9f37c3c06a119ae3a87274fe6173b96f375 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 24 Nov 2024 10:32:27 +0900 Subject: [PATCH 01/15] Update kogera version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index f15745d..2720552 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ val jacksonVersion = libs.versions.jackson.get() val generatedSrcPath = "${layout.buildDirectory.get()}/generated/kotlin" group = groupStr -version = "${jacksonVersion}-beta15" +version = "${jacksonVersion}-beta16" repositories { mavenCentral() From b9fd796f1fbf0fc06392d1358839579c8013fa5d Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 24 Nov 2024 10:40:30 +0900 Subject: [PATCH 02/15] Update test-main.yml --- .github/workflows/test-main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-main.yml b/.github/workflows/test-main.yml index 0449cd7..c5ed305 100644 --- a/.github/workflows/test-main.yml +++ b/.github/workflows/test-main.yml @@ -53,9 +53,9 @@ jobs: - name: '2.0.21 K2' version: '2.0.21' k2: true - - name: '2.1.0-RC' + - name: '2.1.0-RC2' k2: false - - name: '2.1.0-RC K2' + - name: '2.1.0-RC2 K2' k2: true env: KOTLIN_VERSION: ${{ matrix.kotlin.version }} From ceb4e669ced027456a8cc4915fd03e3e0a5c6172 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 24 Nov 2024 12:38:05 +0900 Subject: [PATCH 03/15] Add dependabot temp --- .github/dependabot.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5658bf8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,25 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 + +updates: + - package-ecosystem: "gradle" + directory: "/" + schedule: + interval: "weekly" + # Friday 19:00 JST + day: "saturday" + time: "04:00" + groups: + dependencies: + patterns: + - "*" + ignore: + # The version of Kotlin is fixed to the lowest, so it is not subject to automatic updates + - dependency-name: "kotlin" + - dependency-name: "kotlinx-metadata-jvm" + # linter is not subject to automatic renewal as it will be migrated to detekt in the future + - dependency-name: "kotlinter" From 59b137c29f668e0baaa6e2a424bb8ba7a6891438 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 24 Nov 2024 12:50:00 +0900 Subject: [PATCH 04/15] Fix ignored dep name --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5658bf8..65ff670 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -22,4 +22,4 @@ updates: - dependency-name: "kotlin" - dependency-name: "kotlinx-metadata-jvm" # linter is not subject to automatic renewal as it will be migrated to detekt in the future - - dependency-name: "kotlinter" + - dependency-name: "org.jmailen.kotlinter" From 080c3e6db0655490b05f20196f9fd56c51bc9656 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Fri, 29 Nov 2024 22:52:07 +0900 Subject: [PATCH 05/15] Modified to verify with more specific exception --- .../module/kogera/zPorted/test/StrictNullChecksTest.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/StrictNullChecksTest.kt b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/StrictNullChecksTest.kt index 6fd2dfd..480175d 100644 --- a/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/StrictNullChecksTest.kt +++ b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/StrictNullChecksTest.kt @@ -1,7 +1,7 @@ package io.github.projectmapk.jackson.module.kogera.zPorted.test import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.exc.MismatchedInputException +import com.fasterxml.jackson.databind.exc.InvalidNullException import io.github.projectmapk.jackson.module.kogera.KotlinFeature.StrictNullChecks import io.github.projectmapk.jackson.module.kogera.kotlinModule import io.github.projectmapk.jackson.module.kogera.readValue @@ -37,7 +37,7 @@ class StrictNullChecksTest { @Test fun testListOfInt() { val json = """{"samples":[1, null]}""" - assertThrows { mapper.readValue(json) } + assertThrows { mapper.readValue(json) } } private data class ClassWithNullableListOfInt(val samples: List?) @@ -65,7 +65,7 @@ class StrictNullChecksTest { @Test fun testArrayOfInt() { val json = """{"samples":[1, null]}""" - assertThrows { mapper.readValue(json) } + assertThrows { mapper.readValue(json) } } private data class ClassWithNullableArrayOfInt(val samples: Array?) @@ -93,7 +93,7 @@ class StrictNullChecksTest { @Test fun testMapOfStringToIntWithNullValue() { val json = """{ "samples": { "key": null } }""" - assertThrows { mapper.readValue(json) } + assertThrows { mapper.readValue(json) } } private data class ClassWithNullableMapOfStringToInt(val samples: Map?) From cb7981cc50a011023a211d956c466749966c0c18 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Fri, 29 Nov 2024 23:37:53 +0900 Subject: [PATCH 06/15] Update Kotlin to 1.9.25 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 559eac5..cc249f8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "1.8.22" # Mainly for CI, it can be rewritten by environment variable. +kotlin = "1.9.25" # Mainly for CI, it can be rewritten by environment variable. jackson = "2.18.1" # test libs From 8581f63b4e1164909ae19746f7ea0252eab3d933 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Fri, 29 Nov 2024 23:38:29 +0900 Subject: [PATCH 07/15] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 358c5c1..1adc4e2 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Details are summarized in [KogeraSpecificImplementations](./docs/KogeraSpecificI # Compatibility - `jackson 2.18.x` - `Java 8+` -- `Kotlin 1.8.22+` +- `Kotlin 1.9.25+` ## About compatibility checks Compatibility checks for `Java` and `Kotlin` are done by `CI` grid tests. From 5ecc5c1731eddd94b1edd26fd0f538bcfaea2494 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Fri, 29 Nov 2024 23:38:48 +0900 Subject: [PATCH 08/15] Update CI --- .github/workflows/test-main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test-main.yml b/.github/workflows/test-main.yml index c5ed305..f0c8434 100644 --- a/.github/workflows/test-main.yml +++ b/.github/workflows/test-main.yml @@ -38,9 +38,6 @@ jobs: java-version: [ '8', '11', '17', '21', '23' ] # Minimum version, latest release version, latest pre-release version (if exists) kotlin: - - name: '1.8.22' - version: '1.8.22' - k2: false - name: '1.9.25' version: '1.9.25' k2: false From 9119309f68935fe05c62541633cf3d862f11f01b Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Fri, 29 Nov 2024 23:48:38 +0900 Subject: [PATCH 09/15] Update jackson version --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cc249f8..df6bfd6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] kotlin = "1.9.25" # Mainly for CI, it can be rewritten by environment variable. -jackson = "2.18.1" +jackson = "2.18.2" # test libs junit = "5.11.3" From f4a29e22e1542e9dfb50a0324fa7e22f179cdea3 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 24 Nov 2024 01:47:12 +0900 Subject: [PATCH 10/15] Porting check for #841 https://github.com/FasterXML/jackson-module-kotlin/pull/850 --- .../kogera/zPorted/test/github/GitHub841.kt | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub841.kt diff --git a/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub841.kt b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub841.kt new file mode 100644 index 0000000..75a7640 --- /dev/null +++ b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub841.kt @@ -0,0 +1,34 @@ +package io.github.projectmapk.jackson.module.kogera.zPorted.test.github + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import io.github.projectmapk.jackson.module.kogera.readValue +import io.github.projectmapk.jackson.module.kogera.registerKotlinModule +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test + +class GitHub841 { + object Foo { + override fun toString(): String = "Foo()" + + @JvmStatic + @JsonCreator + fun deserialize(): Foo { + return Foo + } + } + + private val mapper = ObjectMapper() + .setSerializationInclusion(JsonInclude.Include.NON_ABSENT) + .registerKotlinModule() + + @Test + fun shouldDeserializeSimpleObject() { + val value = Foo + val serialized = mapper.writeValueAsString(value) + val deserialized = mapper.readValue(serialized) + + assertEquals(value, deserialized) + } +} From b1096b6f5ec481934fef65a749b28d499303ef82 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 30 Nov 2024 14:27:44 +0900 Subject: [PATCH 11/15] proj --- .idea/kotlinc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 9a55c2d..4cb7457 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file From 3fd4802c7f6898aeb7bb5a3e1c6a5dd859bcfb62 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 30 Nov 2024 14:45:18 +0900 Subject: [PATCH 12/15] Removed references to Issue that is no longer actually corrected With the 2.15.2-beta3 fix, the Java style getter is no longer ignored, so this issue is back. https://github.com/ProjectMapK/jackson-module-kogera/releases/tag/2.15.2-beta3 Since this is an edge case and can be handled by the user, I will not consider addressing this Issue. --- docs/FixedIssues.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/FixedIssues.md b/docs/FixedIssues.md index fc6e0eb..9b18a53 100644 --- a/docs/FixedIssues.md +++ b/docs/FixedIssues.md @@ -2,7 +2,6 @@ A list of issues that have not been resolved in `jackson-module-kotlin`, but hav ## Fixed - [Getting MismatchedInputException instead of MissingKotlinParameterException · Issue \#234](https://github.com/FasterXML/jackson-module-kotlin/issues/234) -- [Private getter with different return type hides property · Issue \#341](https://github.com/FasterXML/jackson-module-kotlin/issues/341) - [Remove \`kotlin\-reflect\` and replace it with \`kotlinx\-metadata\-jvm\` · Issue \#450](https://github.com/FasterXML/jackson-module-kotlin/issues/450) - [Annotation given to constructor parameters containing \`value class\` as argument does not work · Issue \#651](https://github.com/FasterXML/jackson-module-kotlin/issues/651) - [How to deserialize a kotlin\.ranges\.ClosedRange with Jackson · Issue \#663](https://github.com/FasterXML/jackson-module-kotlin/issues/663) From 96b9e4ac63e5c1f592a974b83019da1d41b6744a Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 15 Dec 2024 23:39:59 +0900 Subject: [PATCH 13/15] Added test case for FAIL_ON_NULL_FOR_PRIMITIVES from https://github.com/FasterXML/jackson-module-kotlin/pull/868 --- .../deser/FailNullForPrimitiveTest.kt | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zIntegration/deser/FailNullForPrimitiveTest.kt b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zIntegration/deser/FailNullForPrimitiveTest.kt index 30218c3..cbea77b 100644 --- a/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zIntegration/deser/FailNullForPrimitiveTest.kt +++ b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zIntegration/deser/FailNullForPrimitiveTest.kt @@ -9,24 +9,42 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows private class FailNullForPrimitiveTest { - data class Dto( + val mapper = jacksonObjectMapper() + .enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + + data class NoDefaultValue( val foo: Int, val bar: Int? ) @Test - fun test() { - val mapper = jacksonObjectMapper() - .enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + fun noDefaultValueTest() { + // If no default value is set, it will fail if undefined or null is entered + assertThrows { + mapper.readValue("{}") + } assertThrows { - mapper.readValue("{}") + mapper.readValue("""{"foo":null}""") } + assertEquals(NoDefaultValue(0, null), mapper.readValue("""{"foo":0}""")) + } + + data class HasDefaultValue( + val foo: Int = -1, + val bar: Int? = -1 + ) + + @Test + fun hasDefaultValueTest() { + // If a default value is set, an input of undefined will succeed, but null will fail + assertEquals(HasDefaultValue(-1, -1), mapper.readValue("{}")) + assertThrows { - mapper.readValue("""{"foo":null}""") + mapper.readValue("""{"foo":null}""") } - assertEquals(Dto(0, null), mapper.readValue("""{"foo":0}""")) + assertEquals(HasDefaultValue(0, null), mapper.readValue("""{"foo":0, "bar":null}""")) } } From 90b4008a8ec1b1fbf2fda70f35db5e291df2da64 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 15 Dec 2024 23:41:49 +0900 Subject: [PATCH 14/15] Replaced Enum.values with Enum.entries from https://github.com/FasterXML/jackson-module-kotlin/pull/869 --- .../projectmapk/jackson/module/kogera/KotlinFeature.kt | 2 +- .../projectmapk/jackson/module/kogera/KotlinModuleTest.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinFeature.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinFeature.kt index 2b99e7d..8cafd97 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinFeature.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinFeature.kt @@ -89,7 +89,7 @@ public enum class KotlinFeature(internal val enabledByDefault: Boolean) { public companion object { internal val defaults - get() = values().fold(BitSet(Int.SIZE_BITS)) { acc, cur -> + get() = entries.fold(BitSet(Int.SIZE_BITS)) { acc, cur -> acc.apply { if (cur.enabledByDefault) this.or(cur.bitSet) } } } diff --git a/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinModuleTest.kt b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinModuleTest.kt index 2199456..6b8d065 100644 --- a/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinModuleTest.kt +++ b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinModuleTest.kt @@ -15,7 +15,7 @@ class KotlinModuleTest { @Test fun setKotlinFeatureTest() { val builder = KotlinModule.Builder().apply { - KotlinFeature.values().forEach { enable(it) } + KotlinFeature.entries.forEach { enable(it) } } assertTrue(builder.isEnabled(KotlinFeature.NullToEmptyCollection)) @@ -27,7 +27,7 @@ class KotlinModuleTest { assertTrue(builder.isEnabled(KotlinFeature.UseJavaDurationConversion)) builder.apply { - KotlinFeature.values().forEach { disable(it) } + KotlinFeature.entries.forEach { disable(it) } } assertFalse(builder.isEnabled(KotlinFeature.NullToEmptyCollection)) @@ -84,7 +84,7 @@ class KotlinModuleTest { val module = KotlinModule.Builder().apply { withCacheSize(KotlinModule.CacheSize(123, 321)) - KotlinFeature.values().forEach { + KotlinFeature.entries.forEach { configure(it, enabled) } }.build() From 6ce4b6e54885874ed7971f0b33d80c7dfd5ae603 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 04:26:09 +0000 Subject: [PATCH 15/15] Bump the dependencies group with 4 updates Bumps the dependencies group with 4 updates: [org.junit.jupiter:junit-jupiter-api](https://github.com/junit-team/junit5), [org.junit.jupiter:junit-jupiter-params](https://github.com/junit-team/junit5), [org.junit.jupiter:junit-jupiter-engine](https://github.com/junit-team/junit5) and [io.mockk:mockk](https://github.com/mockk/mockk). Updates `org.junit.jupiter:junit-jupiter-api` from 5.11.3 to 5.11.4 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.11.3...r5.11.4) Updates `org.junit.jupiter:junit-jupiter-params` from 5.11.3 to 5.11.4 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.11.3...r5.11.4) Updates `org.junit.jupiter:junit-jupiter-engine` from 5.11.3 to 5.11.4 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.11.3...r5.11.4) Updates `org.junit.jupiter:junit-jupiter-params` from 5.11.3 to 5.11.4 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.11.3...r5.11.4) Updates `org.junit.jupiter:junit-jupiter-engine` from 5.11.3 to 5.11.4 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.11.3...r5.11.4) Updates `io.mockk:mockk` from 1.13.13 to 1.13.14 - [Release notes](https://github.com/mockk/mockk/releases) - [Commits](https://github.com/mockk/mockk/compare/1.13.13...1.13.14) --- updated-dependencies: - dependency-name: org.junit.jupiter:junit-jupiter-api dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: org.junit.jupiter:junit-jupiter-params dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: org.junit.jupiter:junit-jupiter-engine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: org.junit.jupiter:junit-jupiter-params dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: org.junit.jupiter:junit-jupiter-engine dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: io.mockk:mockk dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index df6bfd6..88fe311 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ kotlin = "1.9.25" # Mainly for CI, it can be rewritten by environment variable. jackson = "2.18.2" # test libs -junit = "5.11.3" +junit = "5.11.4" [libraries] kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib" } @@ -16,7 +16,7 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect" } junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } junit-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" } junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } -mockk = "io.mockk:mockk:1.13.13" +mockk = "io.mockk:mockk:1.13.14" jackson-xml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-xml", version.ref = "jackson" } jackson-jsr310 = { module = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310", version.ref = "jackson" }