Skip to content

Commit 9327444

Browse files
committed
Simplify acquisition of unboxed type
Because the return value of creator handled by KotlinModule is always an unboxed type.
1 parent 5c79a8e commit 9327444

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/Converters.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ internal class ValueClassUnboxConverter<T : Any>(val valueClass: Class<T>) : Std
2929
private val unboxMethod = valueClass.getDeclaredMethod("unbox-impl").apply {
3030
if (!this.isAccessible) this.isAccessible = true
3131
}
32-
val unboxedClass: Class<*> = unboxMethod.returnType
3332

3433
override fun convert(value: T): Any? = unboxMethod.invoke(value)
3534

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/deserializers/KotlinDeserializers.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ internal class KotlinDeserializers(
169169
rawClass == KotlinDuration::class.java ->
170170
JavaToKotlinDurationConverter.takeIf { useJavaDurationConversion }?.delegatingDeserializer
171171
rawClass.isUnboxableValueClass() -> findValueCreator(type, rawClass, cache.getJmClass(rawClass)!!)?.let {
172-
val unboxedClass = cache.getValueClassUnboxConverter(rawClass).unboxedClass
172+
val unboxedClass = it.returnType
173173
val converter = cache.getValueClassBoxConverter(unboxedClass, rawClass)
174174
WrapsNullableValueClassBoxDeserializer(it, converter)
175175
}

0 commit comments

Comments
 (0)