Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2024-12-29 11:02:56 +0000 #257

Merged
merged 25 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
efcbf9f
Update kogera version
k163377 Nov 24, 2024
9559449
Merge pull request #246 from ProjectMapK/k163377-patch-1
k163377 Nov 24, 2024
b9fd796
Update test-main.yml
k163377 Nov 24, 2024
87985ee
Merge pull request #247 from ProjectMapK/k163377-patch-1
k163377 Nov 24, 2024
ceb4e66
Add dependabot temp
k163377 Nov 24, 2024
8f1ed41
Merge pull request #248 from ProjectMapK/add-dependabot
k163377 Nov 24, 2024
59b137c
Fix ignored dep name
k163377 Nov 24, 2024
2465bca
Merge pull request #250 from ProjectMapK/fix/dependabot
k163377 Nov 24, 2024
080c3e6
Modified to verify with more specific exception
k163377 Nov 29, 2024
b5b78c7
Merge pull request #251 from ProjectMapK/fix/test
k163377 Nov 29, 2024
cb7981c
Update Kotlin to 1.9.25
k163377 Nov 29, 2024
8581f63
Update README
k163377 Nov 29, 2024
5ecc5c1
Update CI
k163377 Nov 29, 2024
4e59b5d
Merge pull request #252 from ProjectMapK/update-kotlin
k163377 Nov 29, 2024
9119309
Update jackson version
k163377 Nov 29, 2024
f4a29e2
Porting check for #841
k163377 Nov 23, 2024
75cdf65
Merge pull request #253 from ProjectMapK/update-jackson
k163377 Nov 29, 2024
b1096b6
proj
k163377 Nov 30, 2024
3fd4802
Removed references to Issue that is no longer actually corrected
k163377 Nov 30, 2024
c405372
Merge pull request #254 from ProjectMapK/fix-doc
k163377 Nov 30, 2024
96b9e4a
Added test case for FAIL_ON_NULL_FOR_PRIMITIVES
k163377 Dec 15, 2024
90b4008
Replaced Enum.values with Enum.entries
k163377 Dec 15, 2024
f74fc40
Merge pull request #255 from ProjectMapK/porting
k163377 Dec 15, 2024
6ce4b6e
Bump the dependencies group with 4 updates
dependabot[bot] Dec 21, 2024
87ad105
Merge pull request #256 from ProjectMapK/dependabot/gradle/dependenci…
k163377 Dec 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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: "org.jmailen.kotlinter"
7 changes: 2 additions & 5 deletions .github/workflows/test-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -53,9 +50,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 }}
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion docs/FixedIssues.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> with Jackson · Issue \#663](https://github.com/FasterXML/jackson-module-kotlin/issues/663)
Expand Down
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
kotlin = "1.8.22" # Mainly for CI, it can be rewritten by environment variable.
jackson = "2.18.1"
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" }
Expand All @@ -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" }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MismatchedInputException> {
mapper.readValue<NoDefaultValue>("{}")
}

assertThrows<MismatchedInputException> {
mapper.readValue<Dto>("{}")
mapper.readValue<NoDefaultValue>("""{"foo":null}""")
}

assertEquals(NoDefaultValue(0, null), mapper.readValue<NoDefaultValue>("""{"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<HasDefaultValue>("{}"))

assertThrows<MismatchedInputException> {
mapper.readValue<Dto>("""{"foo":null}""")
mapper.readValue<HasDefaultValue>("""{"foo":null}""")
}

assertEquals(Dto(0, null), mapper.readValue<Dto>("""{"foo":0}"""))
assertEquals(HasDefaultValue(0, null), mapper.readValue<HasDefaultValue>("""{"foo":0, "bar":null}"""))
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -37,7 +37,7 @@ class StrictNullChecksTest {
@Test
fun testListOfInt() {
val json = """{"samples":[1, null]}"""
assertThrows<MismatchedInputException> { mapper.readValue<ClassWithListOfInt>(json) }
assertThrows<InvalidNullException> { mapper.readValue<ClassWithListOfInt>(json) }
}

private data class ClassWithNullableListOfInt(val samples: List<Int>?)
Expand Down Expand Up @@ -65,7 +65,7 @@ class StrictNullChecksTest {
@Test
fun testArrayOfInt() {
val json = """{"samples":[1, null]}"""
assertThrows<MismatchedInputException> { mapper.readValue<ClassWithArrayOfInt>(json) }
assertThrows<InvalidNullException> { mapper.readValue<ClassWithArrayOfInt>(json) }
}

private data class ClassWithNullableArrayOfInt(val samples: Array<Int>?)
Expand Down Expand Up @@ -93,7 +93,7 @@ class StrictNullChecksTest {
@Test
fun testMapOfStringToIntWithNullValue() {
val json = """{ "samples": { "key": null } }"""
assertThrows<MismatchedInputException> { mapper.readValue<ClassWithMapOfStringToInt>(json) }
assertThrows<InvalidNullException> { mapper.readValue<ClassWithMapOfStringToInt>(json) }
}

private data class ClassWithNullableMapOfStringToInt(val samples: Map<String, Int>?)
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Foo>(serialized)

assertEquals(value, deserialized)
}
}
Loading