Few cents about my commits

iOS13 PostFix #8: workaround for missing objc classes(ObjCClassNotFoundException)


Apple altogether with introducing new APIs also keeps refactoring existing one. In this case it results in part of API being extracted from class and moved to newly introduced class. And this class is being used as new super. Result class will have schema when super class introduced later than child. This makes problem when running code on iOS older than super was introduced. Bright example:

// since ios 4.1
@interface GKPlayer : GKBasePlayer

// but

// since ios 10.0
@interface GKBasePlayer : NSObject

Root case

RoboVM bro bridge resolves native classes for binded java ones and if class is missing it throws ObjCClassNotFoundException. Existing bindings corrected this behaviour by manually specifying NSObject as super. Also it might require manual copying methods from unsupported super. With iOS13 there are lot of such classes with supers younger than children. Manual corrections becomes problematic and also this leads to lost of common parent class.

The fix (workaround)

How it expected to work:

it should allow to have possibly missing objc classes as parent;

For each missing obj-c class case instead of throwing ObjCClassNotFoundException new objc class will be registered. It will inherit expected super of missing class. Java class will use this as its shadowed objc class.

it should not allow direct instantiation of missing classes.

New class for missing one will override +alloc method and will throw ObjCClassNotFoundException. This makes impossible direct instantiation of missing classes.

It will work as objc runtime doesn’t bother about java side and all native objc methods invocations results in objc_msgsend. Code is delivered as PR442

Other postfixes: