From 35a917ab9fd7a66349d2d918b2b66788babcd36c Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 15 Jan 2022 14:14:10 +0900 Subject: [PATCH] Remove pointless checks and properties. Since the ignoredClassesForImplyingJsonCreator was always emptySet, there was no point in checking it. --- .../com/fasterxml/jackson/module/kotlin/KotlinModule.kt | 4 +--- .../module/kotlin/KotlinNamesAnnotationIntrospector.kt | 3 +-- 2 files changed, 2 insertions(+), 5 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 3672aefa..afbbf9c2 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt @@ -98,8 +98,6 @@ class KotlinModule @Deprecated( const val serialVersionUID = 1L } - private val ignoredClassesForImplyingJsonCreator = emptySet>() - override fun setupModule(context: SetupContext) { super.setupModule(context) @@ -119,7 +117,7 @@ class KotlinModule @Deprecated( } context.insertAnnotationIntrospector(KotlinAnnotationIntrospector(context, cache, nullToEmptyCollection, nullToEmptyMap, nullIsSameAsDefault)) - context.appendAnnotationIntrospector(KotlinNamesAnnotationIntrospector(this, cache, ignoredClassesForImplyingJsonCreator)) + context.appendAnnotationIntrospector(KotlinNamesAnnotationIntrospector(this, cache)) context.addDeserializers(KotlinDeserializers()) 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 0f2e82ee..8aab9533 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt @@ -27,7 +27,7 @@ import kotlin.reflect.jvm.internal.KotlinReflectionInternalError import kotlin.reflect.jvm.javaType import kotlin.reflect.jvm.kotlinFunction -internal class KotlinNamesAnnotationIntrospector(val module: KotlinModule, val cache: ReflectionCache, val ignoredClassesForImplyingJsonCreator: Set>) : NopAnnotationIntrospector() { +internal class KotlinNamesAnnotationIntrospector(val module: KotlinModule, val cache: ReflectionCache) : NopAnnotationIntrospector() { // since 2.4 override fun findImplicitPropertyName(member: AnnotatedMember): String? = when (member) { is AnnotatedMethod -> if (member.name.contains('-') && member.parameterCount == 0) { @@ -64,7 +64,6 @@ internal class KotlinNamesAnnotationIntrospector(val module: KotlinModule, val c // don't add a JsonCreator to any constructor if one is declared already val kClass = cache.kotlinFromJava(member.declaringClass as Class) - .apply { if (this in ignoredClassesForImplyingJsonCreator) return false } val kConstructor = cache.kotlinFromJava(member.annotated as Constructor) ?: return false // TODO: should we do this check or not? It could cause failures if we miss another way a property could be set