From ba52df1ada9596bf86308c2ad61201c00264555d Mon Sep 17 00:00:00 2001 From: aSemy <897017+aSemy@users.noreply.github.com> Date: Fri, 16 Sep 2022 12:26:59 +0200 Subject: [PATCH] value class check - catch KotlinReflectionInternalError might fix #868, caused by #913? --- .../src/jvmMain/kotlin/io/mockk/core/ValueClassSupport.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/mockk-core/src/jvmMain/kotlin/io/mockk/core/ValueClassSupport.kt b/modules/mockk-core/src/jvmMain/kotlin/io/mockk/core/ValueClassSupport.kt index 797926d90..a8a52615c 100644 --- a/modules/mockk-core/src/jvmMain/kotlin/io/mockk/core/ValueClassSupport.kt +++ b/modules/mockk-core/src/jvmMain/kotlin/io/mockk/core/ValueClassSupport.kt @@ -6,6 +6,7 @@ import kotlin.reflect.full.declaredMemberProperties import kotlin.reflect.full.primaryConstructor import kotlin.reflect.jvm.isAccessible import kotlin.reflect.jvm.javaField +import kotlin.reflect.jvm.internal.KotlinReflectionInternalError actual object ValueClassSupport { @@ -61,6 +62,8 @@ actual object ValueClassSupport { private val KClass.isValue_safe: Boolean get() = try { this.isValue + } catch (_: KotlinReflectionInternalError) { + false } catch (_: UnsupportedOperationException) { false }