Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed: ObjCClassNotFoundException when marshaling protocols impleme…
…nted in pure Swift classes (#784) reported over gitter, in scope of CleverAds: ``` "Terminating app due to uncaught exception 'org.robovm.objc.ObjCClassNotFoundException', reason: 'org.robovm.objc.ObjCClassNotFoundException: Could not find Java class corresponding to Objective-C class: CleverAdsSolutions.ImpressionWrapper". ``` ## Root case Then trying to marshal pointer to Java world and turn it into Interface instance ObjC runtime tries find as much complete as possible class instance representation from this pointer to allow to have not just as $ObjCProxy of this interface/protocol but a proper class instance. In case of reported issue: there was expected `CASStatusHandler` protocol in callback. CAS provided pure Swift class `CleverAdsSolutions.ImpressionWrapper` that implemented it. This class is extended from `Swift._SwiftObject` and this class is not known to RoboVM as well. As result everything was terminated with: ObjCClassNotFoundException What is wrong here: - if pointer is not resolved to any class -- $ObjCProxy should be used to marshal into interface implementation; - even if pointer was resolved to best available class in hierarchy (lets say NSObject), it might be not top one that implement interface itself. As result $ObjCProxy will be used as target class for marshalling. ## The fix: consider `ObjCClassNotFoundException` case similar to `not isAssignableFrom` and use $ObjCProxy in both case. changes were done to not throw ObjCClassNotFoundException in case class being resolved on behalf of $ObjCProxy
- Loading branch information