Repository navigation
Samples: Swift 6 language mode JNI sample used from Kotlin - #9
Closed
piercifani wants to merge 1 commit into
Closed
piercifani wants to merge 1 commit into
piercifani wants to merge 1 commit into
Conversation
A jextract (JNI mode) sample whose Swift modules build in Swift 6 language mode and whose bindings are exercised from Kotlin tests: one test file per feature under src/test/kotlin. KotlinSampleModels is a separate module, so types (and later protocols) cross module boundaries. The baseline covers what works today: a struct, a throwing function, an async function awaited as a coroutine, an enum with a payload, and a type from another module. Added to the CI sample matrix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack 1/8 · base:
main· next: #1What
A new sample,
Samples/SwiftJavaExtractJNIKotlinSampleApp. Its jextract (JNI mode) bindings are used from Kotlin, and its Swift modules build in Swift 6 language mode. Every later PR in this stack adds its own Swift fixture and Kotlin test here, so each PR shows the Kotlin code it enables.KotlinSampleModelsandKotlinSampleLibrary. Types (and later protocols) cross the module boundary.src/test/kotlin/com/example/kotlin/, usingkotlin.testandkotlinx-coroutines(await()on the generated futures).memoryManagementMode: allowGlobalAutomatic, so the Kotlin reads without arenas where jextract allows it.ci-validate.sh, like the other samples.Kotlin in this PR
BaselineTest.ktcovers what works onmaintoday: a struct (properties,equals/hashCode), a throwing function, anasyncfunction awaited as a coroutine, an enum with a payload, and a type from the other module.Why
The JNI sample builds in Swift 5 mode and is used from Java. Skip Fuse apps are Swift 6 and their Android code is Kotlin. Several fixes in this stack only show up in Swift 6 mode (
Sendable, actor isolation), and Kotlin differs from Java in ways that matter for the API: lambdas as functional interfaces, getters as properties, platform types, coroutines.Testing
./gradlew :Samples:SwiftJavaExtractJNIKotlinSampleApp:testpasses onmain(5 tests).🤖 Generated with Claude Code