Skip to content

Commit addc854

Browse files
committed
Use registerKotlinModule function to retain backwards compatibility
1 parent 67cc4b2 commit addc854

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

temporal-kotlin/src/main/kotlin/io/temporal/common/converter/KotlinObjectMapperFactory.kt

+2-11
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,15 @@
2121
package io.temporal.common.converter
2222

2323
import com.fasterxml.jackson.databind.ObjectMapper
24-
import com.fasterxml.jackson.module.kotlin.KotlinModule
24+
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
2525

2626
class KotlinObjectMapperFactory {
2727
companion object {
2828
@JvmStatic
2929
fun new(): ObjectMapper {
3030
val mapper = JacksonJsonPayloadConverter.newDefaultObjectMapper()
3131

32-
val km = try {
33-
KotlinModule.Builder()
34-
.build()
35-
} catch (e: NoClassDefFoundError) {
36-
// use deprecated constructor as fallback
37-
@Suppress("deprecation")
38-
KotlinModule()
39-
}
40-
mapper.registerModule(km)
41-
return mapper
32+
return mapper.registerKotlinModule()
4233
}
4334
}
4435
}

0 commit comments

Comments
 (0)