swiftlang / swiftlang/swift-java
Bring more clarity on JDK version requirements
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 1.2k
- Forks
- 123
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 16
Description
Currently the jextract-swift section of the USER_GUIDE tells us that it needs JDK 22 to utilise "Project Panama".
Upon further inspection, I realised that the Java2Swift Program doesn't compile at all if the JDK version is lesser than 21. This is due to the fact that we hardcoded the vmArgs.version to JNI_VERSION_21 while instantiating a JavaVirtualMachine object.
This JNI_VERSION_21 is a preprocessor constant which is only available in JDK 21 or later.
If this is the intended behaviour, It will be better to update the USER_GUIDE to let people know that Java2Swift will need a JDK that is 21 or later. However, if this is not the intended behaviour, then replacing the hardcoded JNI version with a JNI version which corresponds to the user's JDK would be better.
I'm not an expert in this context, but making an assumption that a lot of current enterprises (who would like to move their tech stack from JVM to Swift) need not be running their software in JDK 21 or later would be more realistic. Thus, I believe trying to support older JDKs instead of supporting only JDK 21 or later (unless mandatory such as "Project Panama") will be better for this project. Feel free to correct me if I'm wrong.
Edit: Realised the gradle files also specify JDK 22 to be a requirement.
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 with USER_GUIDE and the Gradle files that specify JDK 22, then inspect Java2Swift where vmArgs.version is set to JNI_VERSION_21. Determine whether the project intends to require JDK 21 or later or support older JDKs; done means the requirement and related behavior are made consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, swift
- Domain
- build-system, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100