Improve discoverability of KT-42254 in case of runtime assertion

This commit is contained in:
Svyatoslav Scherbina
2020-12-23 11:20:35 +03:00
committed by Nikolay Krasko
parent d57802633c
commit acbdd7f8ae
@@ -232,10 +232,13 @@ OBJ_GETTER(Kotlin_boxDouble, KDouble value);
@end; @end;
static void injectToRuntime() { static void injectToRuntime() {
RuntimeCheck(Kotlin_ObjCExport_toKotlinSelector == nullptr, "runtime injected twice"); // If the code below fails, then it is most likely caused by KT-42254.
const char* errorMessage = "runtime injected twice; https://youtrack.jetbrains.com/issue/KT-42254 might be related";
RuntimeCheck(Kotlin_ObjCExport_toKotlinSelector == nullptr, errorMessage);
Kotlin_ObjCExport_toKotlinSelector = @selector(toKotlin:); Kotlin_ObjCExport_toKotlinSelector = @selector(toKotlin:);
RuntimeCheck(Kotlin_ObjCExport_releaseAsAssociatedObjectSelector == nullptr, "runtime injected twice"); RuntimeCheck(Kotlin_ObjCExport_releaseAsAssociatedObjectSelector == nullptr, errorMessage);
Kotlin_ObjCExport_releaseAsAssociatedObjectSelector = @selector(releaseAsAssociatedObject); Kotlin_ObjCExport_releaseAsAssociatedObjectSelector = @selector(releaseAsAssociatedObject);
} }