Disable "Only one Kotlin framework can be loaded currently" check

since all implicit clashes were resolved.
This commit is contained in:
Svyatoslav Scherbina
2019-10-10 17:48:12 +03:00
committed by SvyatoslavScherbina
parent 1f5a13ba19
commit ad5b296b03
-19
View File
@@ -133,8 +133,6 @@ extern "C" id objc_autoreleaseReturnValue(id self);
@interface NSObject (NSObjectToKotlin)
@end;
static void checkLoadedOnce();
@implementation NSObject (NSObjectToKotlin)
-(ObjHeader*)toKotlin:(ObjHeader**)OBJ_RESULT {
RETURN_RESULT_OF(Kotlin_ObjCExport_convertUnmappedObjCObject, self);
@@ -143,13 +141,6 @@ static void checkLoadedOnce();
-(void)releaseAsAssociatedObject {
objc_release(self);
}
+(void)load {
static dispatch_once_t onceToken = 0;
dispatch_once(&onceToken, ^{
checkLoadedOnce();
});
}
@end;
@interface NSString (NSStringToKotlin)
@@ -212,16 +203,6 @@ OBJ_GETTER(Kotlin_boxDouble, KDouble value);
}
@end;
static void checkLoadedOnce() {
Class marker = objc_allocateClassPair([NSObject class], "KotlinFrameworkLoadedOnceMarker", 0);
if (marker == nullptr) {
[NSException raise:NSGenericException
format:@"Only one Kotlin framework can be loaded currently"];
} else {
objc_registerClassPair(marker);
}
}
__attribute__((constructor))
static void injectToRuntime() {
RuntimeCheck(Kotlin_ObjCExport_toKotlinSelector == nullptr, "runtime injected twice");