jextract/jni: Support generic types within Optional and Tuple#657
Merged
ktoso merged 12 commits intoswiftlang:mainfrom Apr 1, 2026
Merged
jextract/jni: Support generic types within Optional and Tuple#657ktoso merged 12 commits intoswiftlang:mainfrom
ktoso merged 12 commits intoswiftlang:mainfrom
Conversation
# Conflicts: # Samples/SwiftJavaExtractJNISampleApp/src/test/java/com/example/swift/GenericTypeTest.java
ktoso
reviewed
Mar 31, 2026
Samples/SwiftJavaExtractJNISampleApp/Sources/MySwiftLibrary/GenericType.swift
Outdated
Show resolved
Hide resolved
ktoso
reviewed
Mar 31, 2026
ktoso
approved these changes
Mar 31, 2026
ktoso
reviewed
Mar 31, 2026
Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+NativeTranslation.swift
Show resolved
Hide resolved
Collaborator
|
Ok happy enough with it, once tests pass |
Contributor
Author
|
It looks like there’s an issue with 32-bit Android. |
Collaborator
|
Thank you! |
Contributor
Author
|
I've confirmed that this is an existing issue related to |
Collaborator
|
Sounds good, thank you! |
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.
Currently, code generation is incorrect when generic types are used in combination with other complex types.
This PR fixes this for Optional and Tuple types.
Key Changes
Previously, when a native function used indirect, the downcall was printed in
JavaNativeConversionStep.This design required calling
.print(.placeholder)during the initial Step of the conversion flow.However, detecting whether a step is the "first" one is difficult during flow construction. To simplify the logic, I have moved the downcall printing to
JNISwift2JavaGenerator.