Repository navigation
JNI: preserve synchronous actor property witnesses - #4
Merged
Merged
Conversation
Honor nonisolated property accessors and expose immutable actor properties through their synchronous protocol getter witnesses. Generate the witness cast so reads remain valid outside the actor's defining module. Add extraction, binding generation, and Java runtime regressions while keeping ordinary actor-isolated properties asynchronous.
This was referenced Oct 23, 2026
Collaborator
Author
|
#14 needs to be merged when this is submitted to the upstream. |
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.
Problem
JNI extraction currently treats actor property accessors as implicitly async even when the property is explicitly
nonisolated. It also misses the synchronous access path provided by an immutable actor property that witnesses a nonisolated protocol getter.For example:
Both getters can be exposed synchronously, so Java callers can write:
Previously, both getters returned
CompletableFuturevalues. Simply removingawaitis insufficient foridentifier: outside the actor's defining module, direct access to the stored property remains isolated. The generated thunk must instead read(record as any Identified).identifier.Changes
nonisolatedmodifiers for property getters and setters.Validation
swift test --disable-experimental-prebuilts --disable-sandbox: passed../gradlew :Samples:SwiftJavaExtractJNISampleApp:test --no-daemon: passed (275 Java tests, no failures or skips).swift-format lint --stricton changed Swift files andgit diff --check: passed.Tested with Apple Swift 6.4 and JetBrains Runtime 25.0.2 on macOS.