swiftlang / swiftlang/swift-java
jextract: Find ways to minimize string copying when passing Java String to Swift
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 1.2k
- Forks
- 123
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 16
Description
We could consider if we never escape the Swift string or maybe also look into https://download.java.net/java/early_access/jdk24/docs/api/java.base/java/lang/foreign/Linker.Option.html#critical(boolean) if for some opt-in methods we could avoid copying.
We may also consider another JavaString type which would implement StringProtocol and we would avoid creating a real String in the Swift side which today forces another copy.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the jextract Java String-to-Swift interop path and the referenced JDK 24 Linker.Option critical(boolean) documentation. Compare the proposed no-escape/critical and JavaString/StringProtocol options; done should be an agreed approach with evidence that string copying is reduced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, swift
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100