From 94afb47f324c91746ff4b6a629957df50a39015b Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 23 Jun 2024 20:42:00 +0900 Subject: [PATCH 1/4] 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 e6c327a6..3ddc3dd1 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 d0ed2147..665f57b5 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/4] Fix cmp --- pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pom.xml b/pom.xml index 9c478986..fe25f3bf 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/4] 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 9fd401e2..ee83ac9d 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 d04ad555..68a53975 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. From d28fc0fa34c1335daef0a8973ff9600952e2fbdf Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 23 Jun 2024 21:09:04 +0900 Subject: [PATCH 4/4] Remove unnecessary option Inline classes are currently available without flags. --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index fe25f3bf..d13f0c4c 100644 --- a/pom.xml +++ b/pom.xml @@ -168,7 +168,6 @@ - -Xinline-classes