Skip to content

Commit

Permalink
~use IgnoreJreRequirement and also intentionally break compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
qwwdfsad committed Oct 26, 2021
1 parent d3f698d commit 5a9be61
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -19,7 +19,7 @@ internal fun <E : Throwable> tryCopyException(exception: E): E? {
if (exception is CopyableThrowable<*>) {
return runCatching { exception.createCopy() as E? }.getOrNull()
}
return WeakMapCtorCache.get(exception.javaClass).invoke(exception) as E?
return ClassValueCtorCache.get(exception.javaClass).invoke(exception) as E?
}

private fun <E : Throwable> createConstructor(clz: Class<E>): Ctor {
Expand Down Expand Up @@ -90,6 +90,7 @@ private object WeakMapCtorCache : CtorCache() {
}
}

@IgnoreJreRequirement
private object ClassValueCtorCache : CtorCache() {
private val cache = object : ClassValue<Ctor>() {
override fun computeValue(type: Class<*>?): Ctor {
Expand Down

0 comments on commit 5a9be61

Please sign in to comment.