@@ -31,14 +31,18 @@ fun Class<*>.isKotlinClass(): Boolean {
31
31
* the default, collections which are typed to disallow null members
32
32
* (e.g. List<String>) may contain null values after deserialization. Enabling it
33
33
* protects against this but has significant performance impact.
34
+ * @param experimentalDeserializationBackend
35
+ * Default: false. Whether to enable experimental deserialization backend. Enabling
36
+ * it significantly improve performance in certain use cases.
34
37
*/
35
38
class KotlinModule @Deprecated(level = DeprecationLevel .WARNING , message = " Use KotlinModule.Builder" ) constructor(
36
39
val reflectionCacheSize : Int = 512 ,
37
40
val nullToEmptyCollection : Boolean = false ,
38
41
val nullToEmptyMap : Boolean = false ,
39
42
val nullIsSameAsDefault : Boolean = false ,
40
43
val singletonSupport : SingletonSupport = DISABLED ,
41
- val strictNullChecks : Boolean = false
44
+ val strictNullChecks : Boolean = false ,
45
+ val experimentalDeserializationBackend : Boolean = false
42
46
) : SimpleModule(PackageVersion .VERSION ) {
43
47
@Deprecated(level = DeprecationLevel .HIDDEN , message = " For ABI compatibility" )
44
48
constructor (
@@ -77,7 +81,8 @@ class KotlinModule @Deprecated(level = DeprecationLevel.WARNING, message = "Use
77
81
builder.isEnabled(KotlinFeature .SingletonSupport ) -> CANONICALIZE
78
82
else -> DISABLED
79
83
},
80
- builder.isEnabled(StrictNullChecks )
84
+ builder.isEnabled(StrictNullChecks ),
85
+ builder.isEnabled(KotlinFeature .ExperimentalDeserializationBackend )
81
86
)
82
87
83
88
companion object {
@@ -95,7 +100,14 @@ class KotlinModule @Deprecated(level = DeprecationLevel.WARNING, message = "Use
95
100
96
101
val cache = ReflectionCache (reflectionCacheSize)
97
102
98
- context.addValueInstantiators(KotlinInstantiators (cache, nullToEmptyCollection, nullToEmptyMap, nullIsSameAsDefault, strictNullChecks))
103
+ context.addValueInstantiators(KotlinInstantiators (
104
+ cache,
105
+ nullToEmptyCollection,
106
+ nullToEmptyMap,
107
+ nullIsSameAsDefault,
108
+ strictNullChecks,
109
+ experimentalDeserializationBackend
110
+ ))
99
111
100
112
when (singletonSupport) {
101
113
DISABLED -> Unit
0 commit comments