Skip to content

Native Swift Set support for jextract/jni#622

Draft
ktoso wants to merge 1 commit intoswiftlang:mainfrom
ktoso:swift-set-support
Draft

Native Swift Set support for jextract/jni#622
ktoso wants to merge 1 commit intoswiftlang:mainfrom
ktoso:swift-set-support

Conversation

@ktoso
Copy link
Collaborator

@ktoso ktoso commented Mar 16, 2026

This provides SwiftSet java wrapper which refers to the Swift Set in native memory, unless explicitly copied. This implements the Set interface in Java.

Resolves #612

Disclosure: this was AI assisted and based on the work on Dictionary, since it is very similar the results are also very similar for Set as they are for Dictionary. I've thoroughly reviewed the code and wrote parts of it.

@ktoso ktoso force-pushed the swift-set-support branch from 5af6a20 to b954135 Compare March 16, 2026 07:18
}

@JavaMethod("$size")
public static func _setSize(environment: UnsafeMutablePointer<JNIEnv?>!, pointer: Int64) -> Int32 {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that we must use _set here otherwise we'll nameclash with the dictionary one as those become global funcs... I'll add docs about this

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.

jextract/jni: Support native Swift Set use from Java

1 participant