skiptools / skiptools/skip-bridge
Bridge Any arguments as AnyDynamicObject if otherwise unmatched
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 6
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
The Main.kt that launches an app contains:
open class MainActivity: AppCompatActivity {
override fun onStart() {
super.onStart()
MyAppNameAppDelegate.shared.onStart(this)
}
}
Where the Swift side has:
public class MyAppNameAppDelegate {
public static let shared = MyAppNameAppDelegate()
public func onStart(_ sender: Any) {
logger.debug("onStart")
}
}
This works fine for a transpiled app, but aborts with a native app:
04-07 21:14:26.433 9406 9406 F DEBUG : Abort message: 'SkipBridge/BridgedTypes.swift:295: Fatal error: Unable to bridge Kotlin/Java instance 0x0000007fcfbd6e84'
04-07 21:14:26.433 9406 9406 F DEBUG : 98 total frames
04-07 21:14:26.433 9406 9406 F DEBUG : backtrace:
04-07 21:14:26.433 9406 9406 F DEBUG : #00 pc 0000000000353d84 /data/app/~~lVnuLapTB3n8vznzzkEN2w==/howdy.skip-w3TL8NGTFSIrU5AYvwiZOQ==/lib/arm64/libswiftCore.so ($ss17_assertionFailure__4file4line5flagss5NeverOs12StaticStringV_SSAHSus6UInt32VtF+164) (BuildId: f673ad45c51559678b698fe2be1e9e17c5288139)
04-07 21:14:26.433 9406 9406 F DEBUG : #01 pc 00000000000a4370 /data/app/~~lVnuLapTB3n8vznzzkEN2w==/howdy.skip-w3TL8NGTFSIrU5AYvwiZOQ==/lib/arm64/libSkipBridge.so ($s10SkipBridge11AnyBridgingV14fromJavaObject_7options8fallbackypSgSvSg_8SwiftJNI19JConvertibleOptionsVypycSgtFZ+2856) (BuildId: 172614ef227348fa0e24b8cb5eb55f26d0a0ccda)
04-07 21:14:26.433 9406 9406 F DEBUG : #02 pc 0000000000081280 /data/app/~~lVnuLapTB3n8vznzzkEN2w==/howdy.skip-w3TL8NGTFSIrU5AYvwiZOQ==/lib/arm64/libHowdySkip.so ($s9HowdySkip0aB27AppDelegate_Swift_onStart_0yySpySPySo18JNINativeInterfaceVGSgG_Svs5Int64VSvtF+168) (BuildId: dd9fe4efbe839300fd57c0983ccb23c0cc1d4509)
04-07 21:14:26.433 9406 9406 F DEBUG : #03 pc 00000000000811cc /data/app/~~lVnuLapTB3n8vznzzkEN2w==/howdy.skip-w3TL8NGTFSIrU5AYvwiZOQ==/lib/arm64/libHowdySkip.so (Java_howdy_skip_HowdySkipAppDelegate_Swift_1onStart_10+8) (BuildId: dd9fe4efbe839300fd57c0983ccb23c0cc1d4509)
04-07 21:14:26.433 9406 9406 F DEBUG : #04 pc 0000000000377030 /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: b10f5696fea1b32039b162aef3850ed3)
04-07 21:14:26.433 9406 9406 F DEBUG : #05 pc 00000000003605a4 /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: b10f5696fea1b32039b162aef3850ed3)
This is due to:
Is there some reason that an "Any" bridged type can't be passed as an AnyDynamicObject instead, when none of the other bridge conversions are matched?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Sources/SkipBridge/BridgedTypes.swift around lines 291-296 and trace AnyBridging.fromJavaObject(_:options:fallback:). Confirm how unmatched Kotlin/Java instances are handled, then verify that passing an Any argument from the native app no longer aborts and instead uses AnyDynamicObject.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, swift
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100