Skip to content

Commit

Permalink
Disable "Only one Kotlin framework can be loaded currently" check
Browse files Browse the repository at this point in the history
since all implicit clashes were resolved.
  • Loading branch information
SvyatoslavScherbina committed Oct 17, 2019
1 parent 1f5a13b commit ad5b296
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions runtime/src/objc/cpp/ObjCExportClasses.mm
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ - (instancetype)copyWithZone:(NSZone *)zone {
@interface NSObject (NSObjectToKotlin)
@end;

static void checkLoadedOnce();

@implementation NSObject (NSObjectToKotlin)
-(ObjHeader*)toKotlin:(ObjHeader**)OBJ_RESULT {
RETURN_RESULT_OF(Kotlin_ObjCExport_convertUnmappedObjCObject, self);
Expand All @@ -143,13 +141,6 @@ -(ObjHeader*)toKotlin:(ObjHeader**)OBJ_RESULT {
-(void)releaseAsAssociatedObject {
objc_release(self);
}

+(void)load {
static dispatch_once_t onceToken = 0;
dispatch_once(&onceToken, ^{
checkLoadedOnce();
});
}
@end;

@interface NSString (NSStringToKotlin)
Expand Down Expand Up @@ -212,16 +203,6 @@ -(ObjHeader*)toKotlin:(ObjHeader**)OBJ_RESULT {
}
@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");
Expand Down

0 comments on commit ad5b296

Please sign in to comment.