From 94afb47f324c91746ff4b6a629957df50a39015b Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 23 Jun 2024 20:42:00 +0900 Subject: [PATCH 1/3] Remove meaningless checks and properties in KNAI --- .../com/fasterxml/jackson/module/kotlin/KotlinModule.kt | 9 +-------- .../module/kotlin/KotlinNamesAnnotationIntrospector.kt | 2 -- 2 files changed, 1 insertion(+), 10 deletions(-) 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 e6c327a67..3ddc3dd10 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt @@ -89,8 +89,6 @@ class KotlinModule private constructor( builder.isEnabled(UseJavaDurationConversion), ) - private val ignoredClassesForImplyingJsonCreator = emptySet>() - override fun setupModule(context: SetupContext) { super.setupModule(context) @@ -114,12 +112,7 @@ class KotlinModule private constructor( nullIsSameAsDefault, useJavaDurationConversion )) - context.appendAnnotationIntrospector( - KotlinNamesAnnotationIntrospector( - cache, - ignoredClassesForImplyingJsonCreator, - kotlinPropertyNameAsImplicitName) - ) + context.appendAnnotationIntrospector(KotlinNamesAnnotationIntrospector(cache, kotlinPropertyNameAsImplicitName)) context.addDeserializers(KotlinDeserializers(cache, useJavaDurationConversion)) context.addKeyDeserializers(KotlinKeyDeserializers) diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt index d0ed21472..665f57b5b 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt @@ -23,7 +23,6 @@ import kotlin.reflect.jvm.javaType internal class KotlinNamesAnnotationIntrospector( private val cache: ReflectionCache, - private val ignoredClassesForImplyingJsonCreator: Set>, private val useKotlinPropertyNameForGetter: Boolean ) : NopAnnotationIntrospector() { private fun getterNameFromJava(member: AnnotatedMethod): String? { @@ -89,7 +88,6 @@ internal class KotlinNamesAnnotationIntrospector( // don't add a JsonCreator to any constructor if one is declared already val kClass = member.declaringClass.kotlin - .apply { if (this in ignoredClassesForImplyingJsonCreator) return false } val kConstructor = cache.kotlinFromJava(member.annotated) ?: return false // TODO: should we do this check or not? It could cause failures if we miss another way a property could be set From 065e7fda5f6e5609fdc15892d8c677317e2557b1 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 23 Jun 2024 20:51:17 +0900 Subject: [PATCH 2/3] Fix cmp --- pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pom.xml b/pom.xml index 9c4789863..fe25f3bfa 100644 --- a/pom.xml +++ b/pom.xml @@ -271,6 +271,9 @@ com.fasterxml.jackson.module.kotlin.KotlinModule$Builder#reflectionCacheSize(int) + + com.fasterxml.jackson.module.kotlin.KotlinNamesAnnotationIntrospector#KotlinNamesAnnotationIntrospector(com.fasterxml.jackson.module.kotlin.ReflectionCache,java.util.Set,boolean) + From baf7efa52b543a3d3286e4c3f8d72fbba29d3c41 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 23 Jun 2024 20:59:27 +0900 Subject: [PATCH 3/3] Update release notes wrt #542 --- release-notes/CREDITS-2.x | 1 + release-notes/VERSION-2.x | 1 + 2 files changed, 2 insertions(+) diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x index 9fd401e26..ee83ac9da 100644 --- a/release-notes/CREDITS-2.x +++ b/release-notes/CREDITS-2.x @@ -17,6 +17,7 @@ Contributors: # 2.18.0 (not yet released) * #782: Organize deprecated contents +* #542: Remove meaningless checks and properties in KNAI # 2.17.2 (not yet released) diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index d04ad5553..68a53975a 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -23,6 +23,7 @@ Co-maintainers: #782: Content marked as deprecated has been reorganized. Several constructors and accessors to properties of KotlinModule.Builder that were marked as DeprecationLevel.ERROR have been removed. Also, the content marked as DeprecationLevel.WARNING is now DeprecationLevel.ERROR. +#542: Remove meaningless checks and properties in KNAI. 2.17.2 (not yet released) #799: Fixed problem with code compiled with 2.17.x losing backward compatibility.