Skip to content

Commit

Permalink
Remove pointless checks and properties.
Browse files Browse the repository at this point in the history
Since the ignoredClassesForImplyingJsonCreator was always emptySet, there was no point in checking it.
  • Loading branch information
k163377 committed Jan 15, 2022
1 parent 99389f3 commit 35a917a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ class KotlinModule @Deprecated(
const val serialVersionUID = 1L
}

private val ignoredClassesForImplyingJsonCreator = emptySet<KClass<*>>()

override fun setupModule(context: SetupContext) {
super.setupModule(context)

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<KClass<*>>) : 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) {
Expand Down Expand Up @@ -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<Any>)
.apply { if (this in ignoredClassesForImplyingJsonCreator) return false }
val kConstructor = cache.kotlinFromJava(member.annotated as Constructor<Any>) ?: return false

// TODO: should we do this check or not? It could cause failures if we miss another way a property could be set
Expand Down

0 comments on commit 35a917a

Please sign in to comment.