Skip to content

Commit 6b374aa

Browse files
authored
Merge pull request #839 from k163377/fix-dep3
Remove useKotlinPropertyNameForGetter and unify with kotlinPropertyNameAsImplicitName
2 parents 8c971d0 + d47100e commit 6b374aa

File tree

5 files changed

+8
-17
lines changed

5 files changed

+8
-17
lines changed

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@
239239
<excludes>
240240
<!-- public -->
241241
<!-- removed -->
242+
<exclude>
243+
com.fasterxml.jackson.module.kotlin.KotlinModule#getUseKotlinPropertyNameForGetter()
244+
</exclude>
242245
<exclude>com.fasterxml.jackson.module.kotlin.KotlinModule#getSingletonSupport()</exclude>
243246
<exclude>com.fasterxml.jackson.module.kotlin.SingletonSupport</exclude>
244247
<!-- internal -->

release-notes/CREDITS-2.x

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Contributors:
1818
# 2.19.0 (not yet released)
1919

2020
WrongWrong (@k163377)
21+
* #839: Remove useKotlinPropertyNameForGetter and unify with kotlinPropertyNameAsImplicitName
2122
* #835: Remove old SingletonSupport class and unified with KotlinFeature.SingletonSupport
2223

2324
# 2.18.0 (26-Sep-2024)

release-notes/VERSION-2.x

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Co-maintainers:
1818

1919
2.19.0 (not yet released)
2020

21+
#839: Remove useKotlinPropertyNameForGetter and unify with kotlinPropertyNameAsImplicitName.
2122
#835: Remove old SingletonSupport class and unified with KotlinFeature.SingletonSupport.
2223

2324
2.18.0 (26-Sep-2024)

src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,9 @@ class KotlinModule private constructor(
4343
val nullIsSameAsDefault: Boolean = NullIsSameAsDefault.enabledByDefault,
4444
val singletonSupport: Boolean = SingletonSupport.enabledByDefault,
4545
val strictNullChecks: Boolean = StrictNullChecks.enabledByDefault,
46-
@Deprecated(
47-
level = DeprecationLevel.ERROR,
48-
message = "There was a discrepancy between the property name and the Feature name." +
49-
" To migrate to the correct property name, it will be ERROR in 2.18 and removed in 2.19.",
50-
replaceWith = ReplaceWith("kotlinPropertyNameAsImplicitName")
51-
)
52-
val useKotlinPropertyNameForGetter: Boolean = KotlinPropertyNameAsImplicitName.enabledByDefault,
46+
val kotlinPropertyNameAsImplicitName: Boolean = KotlinPropertyNameAsImplicitName.enabledByDefault,
5347
val useJavaDurationConversion: Boolean = UseJavaDurationConversion.enabledByDefault,
5448
) : SimpleModule(KotlinModule::class.java.name, PackageVersion.VERSION) {
55-
@Suppress("DEPRECATION_ERROR")
56-
val kotlinPropertyNameAsImplicitName: Boolean get() = useKotlinPropertyNameForGetter
57-
5849
/*
5950
* Prior to 2.18, an older Enum called SingletonSupport was used to manage feature.
6051
* To deprecate it and replace it with singletonSupport: Boolean, the following steps are in progress.

src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package com.fasterxml.jackson.module.kotlin
22

3-
import com.fasterxml.jackson.annotation.JsonCreator
43
import com.fasterxml.jackson.annotation.JsonProperty
54
import com.fasterxml.jackson.databind.JavaType
65
import com.fasterxml.jackson.databind.cfg.MapperConfig
76
import com.fasterxml.jackson.databind.introspect.Annotated
87
import com.fasterxml.jackson.databind.introspect.AnnotatedClass
9-
import com.fasterxml.jackson.databind.introspect.AnnotatedConstructor
108
import com.fasterxml.jackson.databind.introspect.AnnotatedMember
119
import com.fasterxml.jackson.databind.introspect.AnnotatedMethod
1210
import com.fasterxml.jackson.databind.introspect.AnnotatedParameter
@@ -16,18 +14,15 @@ import java.lang.reflect.Constructor
1614
import java.util.Locale
1715
import kotlin.reflect.KClass
1816
import kotlin.reflect.KFunction
19-
import kotlin.reflect.full.companionObject
20-
import kotlin.reflect.full.declaredFunctions
2117
import kotlin.reflect.full.hasAnnotation
2218
import kotlin.reflect.full.memberProperties
2319
import kotlin.reflect.full.primaryConstructor
24-
import kotlin.reflect.jvm.javaConstructor
2520
import kotlin.reflect.jvm.javaGetter
2621
import kotlin.reflect.jvm.javaType
2722

2823
internal class KotlinNamesAnnotationIntrospector(
2924
private val cache: ReflectionCache,
30-
private val useKotlinPropertyNameForGetter: Boolean
25+
private val kotlinPropertyNameAsImplicitName: Boolean
3126
) : NopAnnotationIntrospector() {
3227
private fun getterNameFromJava(member: AnnotatedMethod): String? {
3328
val name = member.name
@@ -67,7 +62,7 @@ internal class KotlinNamesAnnotationIntrospector(
6762

6863
return when (member) {
6964
is AnnotatedMethod -> if (member.parameterCount == 0) {
70-
if (useKotlinPropertyNameForGetter) {
65+
if (kotlinPropertyNameAsImplicitName) {
7166
// Fall back to default if it is a getter-like function
7267
getterNameFromKotlin(member) ?: getterNameFromJava(member)
7368
} else getterNameFromJava(member)

0 commit comments

Comments
 (0)