Skip to content

Fix Int? argument issues on 32-bit environments#667

Open
sidepelican wants to merge 7 commits intoswiftlang:mainfrom
sidepelican:fixed_witdh_Int
Open

Fix Int? argument issues on 32-bit environments#667
sidepelican wants to merge 7 commits intoswiftlang:mainfrom
sidepelican:fixed_witdh_Int

Conversation

@sidepelican
Copy link
Copy Markdown
Contributor

This PR fixes issues related to Int? arguments on 32-bit architectures.
The generated code contained numerous errors. (The failing CI run: https://github.com/swiftlang/swift-java/actions/runs/23786261629/job/69318324924 )

Background

During my investigation, I realized that the dynamic nature of Int.JNIType was significantly complicating the logic.
I have already submitted a PR to address this: swiftlang/swift-java-jni-core#16

In this PR, I have removed the various implementation pieces that were previously used to manually wrap Int into Int64.
With the unified JNIType, these are no longer necessary, and removing them resolves the original problem.

Verification

I have verified that the generated code compiles correctly for 32-bit by running the following command in SwiftJavaExtractJNISampleApp:

./gradlew assemble -PswiftSdk=armv7-unknown-linux-android28

While the compilation is successful, I do not have a 32-bit Android runtime environment, so I haven't been able to verify the actual execution results.

# Conflicts:
#	Sources/JExtractSwiftLib/JNI/JNIJavaTypeTranslator.swift
# Conflicts:
#	Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaTranslation.swift
#	Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+SwiftThunkPrinting.swift
@sidepelican sidepelican requested a review from ktoso as a code owner April 1, 2026 08:16
@sidepelican
Copy link
Copy Markdown
Contributor Author

Sorry, I forgot to point this out; This PR requires swiftlang/swift-java-jni-core#16 to be merged first.

@ktoso
Copy link
Copy Markdown
Collaborator

ktoso commented Apr 1, 2026

I see... let's get some Android folks to chime in here, @madsodgaard has an interest in keeping those 32bit runtimes happy.

@marcprux
Copy link
Copy Markdown
Contributor

marcprux commented Apr 1, 2026

If I'm reading this right, I do think it introduces peril for 32-bit platforms like armv7 on Android and other embedded devices.

In swiftlang/swift-java-jni-core#16 (comment) I suggest simply dropping Int conformance to JavaValue, since I don't think there is really any right way to do it for all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants