Skip to content

Commit 7f5513f

Browse files
committed
Merge remote-tracking branch 'FasterXML/2.19'
2 parents 6ba21b1 + 6b374aa commit 7f5513f

File tree

8 files changed

+26
-17
lines changed

8 files changed

+26
-17
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ and those with secondary constructors or static factories are also supported.
1010

1111
# Status
1212

13-
* release `2.17.0` (for Jackson `2.17.x`) [![GitHub Actions build](https://github.com/FasterXML/jackson-module-kotlin/actions/workflows/main.yml/badge.svg?branch=2.16)](https://github.com/FasterXML/jackson-module-kotlin/actions?query=branch%3A2.17)
13+
* release `2.18.0` (for Jackson `2.18.x`) [![GitHub Actions build](https://github.com/FasterXML/jackson-module-kotlin/actions/workflows/main.yml/badge.svg?branch=2.18)](https://github.com/FasterXML/jackson-module-kotlin/actions?query=branch%3A2.18)
14+
* release `2.17.2` (for Jackson `2.17.x`) [![GitHub Actions build](https://github.com/FasterXML/jackson-module-kotlin/actions/workflows/main.yml/badge.svg?branch=2.17)](https://github.com/FasterXML/jackson-module-kotlin/actions?query=branch%3A2.17)
1415
* release `2.16.2` (for Jackson `2.16.x`) [![GitHub Actions build](https://github.com/FasterXML/jackson-module-kotlin/actions/workflows/main.yml/badge.svg?branch=2.16)](https://github.com/FasterXML/jackson-module-kotlin/actions?query=branch%3A2.16)
15-
* release `2.15.3` (for Jackson `2.15.x`) [![GitHub Actions build](https://github.com/FasterXML/jackson-module-kotlin/actions/workflows/main.yml/badge.svg?branch=2.15)](https://github.com/FasterXML/jackson-module-kotlin/actions?query=branch%3A2.15)
16+
* release `2.15.4` (for Jackson `2.15.x`) [![GitHub Actions build](https://github.com/FasterXML/jackson-module-kotlin/actions/workflows/main.yml/badge.svg?branch=2.15)](https://github.com/FasterXML/jackson-module-kotlin/actions?query=branch%3A2.15)
1617
* release `2.14.3` (for Jackson `2.14.x`) [![GitHub Actions build](https://github.com/FasterXML/jackson-module-kotlin/actions/workflows/main.yml/badge.svg?branch=2.14)](https://github.com/FasterXML/jackson-module-kotlin/actions?query=branch%3A2.14)
1718

1819
Releases require that you have included Kotlin stdlib and reflect libraries already.

release-notes/CREDITS-2.x

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ Authors:
1515

1616
Contributors:
1717

18-
# 2.18.0 (not yet released)
18+
# 2.19.0 (not yet released)
19+
20+
WrongWrong (@k163377)
21+
* #839: Remove useKotlinPropertyNameForGetter and unify with kotlinPropertyNameAsImplicitName
22+
* #835: Remove old SingletonSupport class and unified with KotlinFeature.SingletonSupport
23+
24+
# 2.18.0 (26-Sep-2024)
1925

2026
WrongWrong (@k163377)
2127
* #818: Optimize the search process for creators

release-notes/VERSION-2.x

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Co-maintainers:
1818

1919
2.19.0 (not yet released)
2020

21-
- No changes since 2.18
21+
#839: Remove useKotlinPropertyNameForGetter and unify with kotlinPropertyNameAsImplicitName.
22+
#835: Remove old SingletonSupport class and unified with KotlinFeature.SingletonSupport.
2223

2324
2.18.0 (26-Sep-2024)
2425

src/main/kotlin/tools/jackson/module/kotlin/KotlinFeature.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ enum class KotlinFeature(internal val enabledByDefault: Boolean) {
3030
* Deserializing a singleton overwrites the value of the single instance.
3131
*
3232
* See [jackson-module-kotlin#225]: keep Kotlin singletons as singletons.
33-
* @see com.fasterxml.jackson.module.kotlin.SingletonSupport
3433
*/
3534
SingletonSupport(enabledByDefault = false),
3635

src/main/kotlin/tools/jackson/module/kotlin/KotlinModule.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package tools.jackson.module.kotlin
22

3-
import kotlin.reflect.KClass
43
import tools.jackson.databind.MapperFeature
54
import tools.jackson.databind.module.SimpleModule
65
import tools.jackson.module.kotlin.KotlinFeature.*
@@ -18,7 +17,10 @@ fun Class<*>.isKotlinClass(): Boolean = this.isAnnotationPresent(Metadata::class
1817
* map object.
1918
* @property nullIsSameAsDefault Default false. Whether to treat null values as absent when deserializing, thereby
2019
* using the default value provided in Kotlin.
21-
* @property enabledSingletonSupport Default: false. Whether to enable singleton handling.
20+
* @property singletonSupport Default: false. Mode for singleton handling.
21+
* See [KotlinFeature.SingletonSupport]
22+
* @property enabledSingletonSupport Default: false. A temporary property that is maintained until the return value of `singletonSupport` is changed.
23+
* It will be removed in 2.21.
2224
* @property strictNullChecks Default: false. Whether to check deserialized collections. With this disabled,
2325
* the default, collections which are typed to disallow null members
2426
* (e.g. List<String>) may contain null values after deserialization. Enabling it
@@ -33,15 +35,15 @@ class KotlinModule private constructor(
3335
val nullToEmptyCollection: Boolean = NullToEmptyCollection.enabledByDefault,
3436
val nullToEmptyMap: Boolean = NullToEmptyMap.enabledByDefault,
3537
val nullIsSameAsDefault: Boolean = NullIsSameAsDefault.enabledByDefault,
36-
val enabledSingletonSupport: Boolean = SingletonSupport.enabledByDefault,
38+
val singletonSupport: Boolean = SingletonSupport.enabledByDefault,
3739
val strictNullChecks: Boolean = StrictNullChecks.enabledByDefault,
3840
val kotlinPropertyNameAsImplicitName: Boolean = KotlinPropertyNameAsImplicitName.enabledByDefault,
3941
val useJavaDurationConversion: Boolean = UseJavaDurationConversion.enabledByDefault,
4042
) : SimpleModule(KotlinModule::class.java.name, PackageVersion.VERSION) {
4143

4244
companion object {
4345
// Increment when option is added
44-
private const val serialVersionUID = 2L
46+
private const val serialVersionUID = 3L
4547
}
4648

4749
@Deprecated(
@@ -72,7 +74,7 @@ class KotlinModule private constructor(
7274

7375
context.addValueInstantiators(KotlinInstantiators(cache, nullToEmptyCollection, nullToEmptyMap, nullIsSameAsDefault, strictNullChecks))
7476

75-
if (enabledSingletonSupport) {
77+
if (singletonSupport) {
7678
// [module-kotlin#225]: keep Kotlin singletons as singletons
7779
context.addDeserializerModifier(KotlinValueDeserializerModifier)
7880
}

src/main/kotlin/tools/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import kotlin.reflect.jvm.javaType
2222

2323
internal class KotlinNamesAnnotationIntrospector(
2424
private val cache: ReflectionCache,
25-
private val useKotlinPropertyNameForGetter: Boolean
25+
private val kotlinPropertyNameAsImplicitName: Boolean
2626
) : NopAnnotationIntrospector() {
2727
private fun getterNameFromJava(member: AnnotatedMethod): String? {
2828
val name = member.name
@@ -62,7 +62,7 @@ internal class KotlinNamesAnnotationIntrospector(
6262

6363
return when (member) {
6464
is AnnotatedMethod -> if (member.parameterCount == 0) {
65-
if (useKotlinPropertyNameForGetter) {
65+
if (kotlinPropertyNameAsImplicitName) {
6666
// Fall back to default if it is a getter-like function
6767
getterNameFromKotlin(member) ?: getterNameFromJava(member)
6868
} else getterNameFromJava(member)

src/test/kotlin/tools/jackson/module/kotlin/DslTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class DslTest {
4343
assertTrue(module.nullToEmptyCollection)
4444
assertTrue(module.nullToEmptyMap)
4545
assertTrue(module.nullIsSameAsDefault)
46-
assertTrue(module.enabledSingletonSupport)
46+
assertTrue(module.singletonSupport)
4747
assertTrue(module.strictNullChecks)
4848
}
4949

src/test/kotlin/tools/jackson/module/kotlin/KotlinModuleTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class KotlinModuleTest {
1717
assertFalse(module.nullToEmptyCollection)
1818
assertFalse(module.nullToEmptyMap)
1919
assertFalse(module.nullIsSameAsDefault)
20-
assertFalse(module.enabledSingletonSupport)
20+
assertFalse(module.singletonSupport)
2121
assertFalse(module.strictNullChecks)
2222
assertFalse(module.kotlinPropertyNameAsImplicitName)
2323
assertFalse(module.useJavaDurationConversion)
@@ -40,7 +40,7 @@ class KotlinModuleTest {
4040
assertTrue(module.nullToEmptyCollection)
4141
assertTrue(module.nullToEmptyMap)
4242
assertTrue(module.nullIsSameAsDefault)
43-
assertTrue(module.enabledSingletonSupport)
43+
assertTrue(module.singletonSupport)
4444
assertTrue(module.strictNullChecks)
4545
assertTrue(module.kotlinPropertyNameAsImplicitName)
4646
assertTrue(module.useJavaDurationConversion)
@@ -79,7 +79,7 @@ class KotlinModuleTest {
7979
enable(SingletonSupport)
8080
}.build()
8181

82-
assertTrue(module.enabledSingletonSupport)
82+
assertTrue(module.singletonSupport)
8383
}
8484

8585
@Test
@@ -110,7 +110,7 @@ class KotlinModuleTest {
110110
assertTrue(deserialized.nullToEmptyCollection)
111111
assertTrue(deserialized.nullToEmptyMap)
112112
assertTrue(deserialized.nullIsSameAsDefault)
113-
assertTrue(deserialized.enabledSingletonSupport)
113+
assertTrue(deserialized.singletonSupport)
114114
assertTrue(deserialized.strictNullChecks)
115115
}
116116

0 commit comments

Comments
 (0)