Skip to content

jextract/jni: Add support for returning protocols#814

Open
madsodgaard wants to merge 3 commits into
swiftlang:mainfrom
madsodgaard:jni-return-protocols
Open

jextract/jni: Add support for returning protocols#814
madsodgaard wants to merge 3 commits into
swiftlang:mainfrom
madsodgaard:jni-return-protocols

Conversation

@madsodgaard

Copy link
Copy Markdown
Contributor

Adds support for returning any P / some P from a function, variable etc...

This is done by generating a <P>Box instance in Java, that makes downcalls by opening the existential and calling a cdecl. This box implements both all protocol requirements and any inherited protocol requirements.

One special thing is for setters, where we need to do a "load-mutate-store", because it might be a value type.

Closes #380

@madsodgaard madsodgaard requested a review from ktoso as a code owner July 2, 2026 10:47
@madsodgaard madsodgaard changed the title jextract/jin: Add support for returning protocols jextract/jni: Add support for returning protocols Jul 2, 2026
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] Add support for returning protocol types

2 participants