Skip to content

jextract/jni: Handle unexpected types gracefully in Map#732

Merged
ktoso merged 1 commit into
swiftlang:mainfrom
sidepelican:boxed_key
May 12, 2026
Merged

jextract/jni: Handle unexpected types gracefully in Map#732
ktoso merged 1 commit into
swiftlang:mainfrom
sidepelican:boxed_key

Conversation

@sidepelican
Copy link
Copy Markdown
Contributor

In Java, methods such as Map.get(Object key) or Map.containsKey(Object key) are designed to accept any Object.
However, the current Swift implementation assumes a specific type will be passed.
If a value of an unexpected type is encountered, it leads to a runtime crash.

I have updated the implementation to handle type mismatches.
Instead of crashing, the code now aligns with standard Java semantics by returning null or false.

@sidepelican sidepelican requested a review from ktoso as a code owner May 8, 2026 08:13
@ktoso ktoso merged commit 50b2d58 into swiftlang:main May 12, 2026
64 checks passed
@sidepelican sidepelican deleted the boxed_key branch May 12, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants