We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
runCatching-map-getOrDefault
1 parent 8c74daf commit cdb14b2Copy full SHA for cdb14b2
core/jvmMain/src/kotlinx/serialization/internal/Caching.kt
@@ -17,9 +17,12 @@ import kotlin.reflect.KTypeProjection
17
* but ClassValue is not available on Android, thus we attempt to check it dynamically
18
* and fallback to ConcurrentHashMap-based cache.
19
*/
20
-private val useClassValue = runCatching {
+private val useClassValue = try {
21
Class.forName("java.lang.ClassValue")
22
-}.map { true }.getOrDefault(false)
+ true
23
+} catch (_: Throwable) {
24
+ false
25
+}
26
27
/**
28
* Creates a **strongly referenced** cache of values associated with [Class].
0 commit comments