Skip to content

Fix Java package mapping for dependent modules#699

Merged
ktoso merged 14 commits intoswiftlang:mainfrom
iDevid:fix/java-dependency-mapping
Apr 16, 2026
Merged

Fix Java package mapping for dependent modules#699
ktoso merged 14 commits intoswiftlang:mainfrom
iDevid:fix/java-dependency-mapping

Conversation

@iDevid
Copy link
Copy Markdown
Contributor

@iDevid iDevid commented Apr 13, 2026

The main goal of this PR is to preserve the mapping between dependent Swift modules and their Java packages so JNI generation can resolve cross-module Java references correctly.

While doing that, I also replaced tuple-based dependent-config plumbing with named structures to make the data flow clearer and less error-prone.

A concrete example of this setup can be found in TriForce: https://github.com/iDevid/TriForce

In that sample project, the Android app depends on SharedNetworkLayer, which in turn depends on SharedModels.

iDevid added 4 commits April 13, 2026 16:30
Pass dependency module-to-package metadata through the
Swift-to-Java pipeline and use it when translating
nominal Java types.

This preserves package names for classes coming from
dependent modules instead of emitting them without a
package.
@iDevid iDevid requested a review from ktoso as a code owner April 13, 2026 16:52
@iDevid iDevid changed the title Preserve dependent modules mapping Fix Java package mapping for dependent modules Apr 13, 2026
Comment thread Sources/JExtractSwiftLib/Convenience/JavaType+Extensions.swift Outdated
Comment thread Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator.swift Outdated
@ktoso
Copy link
Copy Markdown
Collaborator

ktoso commented Apr 14, 2026

Some requests inline, thanks!

@iDevid iDevid requested a review from ktoso April 14, 2026 07:11
@iDevid
Copy link
Copy Markdown
Contributor Author

iDevid commented Apr 14, 2026

Thanks for the feedbacks @ktoso
I've applied your suggestions, let me know if more changes are needed! 🙇

Comment thread Sources/JExtractSwiftLib/Convenience/JavaType+Extensions.swift Outdated
Comment thread Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaTranslation.swift Outdated
@iDevid iDevid requested a review from sidepelican April 15, 2026 10:07
Copy link
Copy Markdown
Collaborator

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Looks good now, thank you.

I've fixed the formatting issue and pushed

@ktoso ktoso merged commit 69a4bff into swiftlang:main Apr 16, 2026
64 checks passed
@ktoso
Copy link
Copy Markdown
Collaborator

ktoso commented Apr 16, 2026

Thank you!

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.

3 participants