Skip to content

Commit c5b6af1

Browse files
committed
Commonize parameter acquisition
1 parent 85de078 commit c5b6af1

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,12 @@ internal class KotlinNamesAnnotationIntrospector(
7373
}
7474

7575
override fun refineDeserializationType(config: MapperConfig<*>, a: Annotated, baseType: JavaType): JavaType =
76-
(a as? AnnotatedParameter)?.let { _ ->
77-
cache.findKotlinParameter(a)?.let { param ->
78-
val rawType = a.rawType
79-
(param.type.classifier as? KClass<*>)
80-
?.java
81-
?.takeIf { it.isUnboxableValueClass() && it != rawType }
82-
?.let { config.constructType(it) }
83-
}
76+
findKotlinParameter(a)?.let { param ->
77+
val rawType = a.rawType
78+
(param.type.classifier as? KClass<*>)
79+
?.java
80+
?.takeIf { it.isUnboxableValueClass() && it != rawType }
81+
?.let { config.constructType(it) }
8482
} ?: baseType
8583

8684
override fun findDefaultCreator(
@@ -106,6 +104,9 @@ internal class KotlinNamesAnnotationIntrospector(
106104
}
107105

108106
private fun findKotlinParameterName(param: AnnotatedParameter): String? = cache.findKotlinParameter(param)?.name
107+
108+
private fun findKotlinParameter(param: Annotated) = (param as? AnnotatedParameter)
109+
?.let { cache.findKotlinParameter(it) }
109110
}
110111

111112
// If it is not a Kotlin class or an Enum, Creator is not used

0 commit comments

Comments
 (0)