Skip to content

Commit 9df7daa

Browse files
committed
Corrected the location of the decision
1 parent 3c90408 commit 9df7daa

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,17 @@ internal class ReflectionCache(reflectionCacheSize: Int) : Serializable {
5757

5858
// Return boxed type on Kotlin for unboxed getters
5959
fun findBoxedReturnType(getter: AnnotatedMethod): Class<*>? {
60-
val method = getter.member.apply {
61-
// If the return value of the getter is a value class,
62-
// it will be serialized properly without doing anything.
63-
// TODO: Verify the case where a value class encompasses another value class.
64-
if (this.returnType.isUnboxableValueClass()) return null
65-
}
66-
60+
val method = getter.member
6761
val optional = valueClassReturnTypeCache.get(method)
6862

6963
return if (optional != null) {
7064
optional
7165
} else {
66+
// If the return value of the getter is a value class,
67+
// it will be serialized properly without doing anything.
68+
// TODO: Verify the case where a value class encompasses another value class.
69+
if (method.returnType.isUnboxableValueClass()) return null
70+
7271
val value = Optional.ofNullable(method.getValueClassReturnType())
7372
(valueClassReturnTypeCache.putIfAbsent(method, value) ?: value)
7473
}.orElse(null)

0 commit comments

Comments
 (0)