From aa7217f4ba0ab09896f5806d6ce9458c072c319f Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 22 Jul 2023 15:45:04 +0900 Subject: [PATCH] Fix for review --- .../com/fasterxml/jackson/module/kotlin/KotlinFeature.kt | 8 ++++---- .../com/fasterxml/jackson/module/kotlin/KotlinModule.kt | 4 ++-- .../jackson/module/kotlin/test/github/Github630.kt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinFeature.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinFeature.kt index c2afef7d..b6143fcc 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinFeature.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinFeature.kt @@ -1,7 +1,6 @@ package com.fasterxml.jackson.module.kotlin import java.util.BitSet -import kotlin.math.pow /** * @see KotlinModule.Builder @@ -45,9 +44,9 @@ enum class KotlinFeature(private val enabledByDefault: Boolean) { StrictNullChecks(enabledByDefault = false), /** - * By enabling this feature, the property name on Kotlin will be used as the getter name. + * By enabling this feature, the property name on Kotlin is used as the implicit name for the getter. * - * By default, the name based on the getter name on the JVM is used as the accessor name. + * By default, the getter name is used during serialization. * This name may be different from the parameter/field name, in which case serialization results * may be incorrect or annotations may malfunction. * See [jackson-module-kotlin#630] for details. @@ -57,8 +56,9 @@ enum class KotlinFeature(private val enabledByDefault: Boolean) { * On the other hand, enabling this option increases the amount of reflection processing, * which may result in performance degradation for both serialization and deserialization. * In addition, the adjustment of behavior using get:JvmName is disabled. + * Note also that this feature does not apply to setters. */ - UseKotlinPropertyNameForGetter(enabledByDefault = false); + KotlinPropertyNameAsImplicitName(enabledByDefault = false); internal val bitSet: BitSet = (1 shl ordinal).toBitSet() diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt index 80c8e743..5d75a1ad 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt @@ -7,7 +7,7 @@ import com.fasterxml.jackson.module.kotlin.KotlinFeature.NullIsSameAsDefault import com.fasterxml.jackson.module.kotlin.KotlinFeature.NullToEmptyCollection import com.fasterxml.jackson.module.kotlin.KotlinFeature.NullToEmptyMap import com.fasterxml.jackson.module.kotlin.KotlinFeature.StrictNullChecks -import com.fasterxml.jackson.module.kotlin.KotlinFeature.UseKotlinPropertyNameForGetter +import com.fasterxml.jackson.module.kotlin.KotlinFeature.KotlinPropertyNameAsImplicitName import com.fasterxml.jackson.module.kotlin.SingletonSupport.CANONICALIZE import com.fasterxml.jackson.module.kotlin.SingletonSupport.DISABLED import java.util.* @@ -105,7 +105,7 @@ class KotlinModule @Deprecated( else -> DISABLED }, builder.isEnabled(StrictNullChecks), - builder.isEnabled(UseKotlinPropertyNameForGetter) + builder.isEnabled(KotlinPropertyNameAsImplicitName) ) companion object { diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github630.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github630.kt index 8c6581ae..a5fb7b63 100644 --- a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github630.kt +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github630.kt @@ -9,7 +9,7 @@ import kotlin.test.assertEquals class Github630 { private val mapper = ObjectMapper() - .registerModule(KotlinModule.Builder().enable(KotlinFeature.UseKotlinPropertyNameForGetter).build())!! + .registerModule(KotlinModule.Builder().enable(KotlinFeature.KotlinPropertyNameAsImplicitName).build())!! data class Dto( // from #570, #603