Skip to content

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

Open
sidepelican wants to merge 1 commit intoswiftlang:mainfrom
sidepelican:boxed_key
Open

jextract/jni: Handle unexpected types gracefully in Map#732
sidepelican wants to merge 1 commit intoswiftlang: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
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.

1 participant