Skip to content

jextract/jni: Skip generating empty JNI cache enums#690

Merged
ktoso merged 3 commits intoswiftlang:mainfrom
sidepelican:small_improvements
Apr 9, 2026
Merged

jextract/jni: Skip generating empty JNI cache enums#690
ktoso merged 3 commits intoswiftlang:mainfrom
sidepelican:small_improvements

Conversation

@sidepelican
Copy link
Copy Markdown
Contributor

This is a small improvement to jextract.

Currently, a _JNI_ cache enum is generated for every class, even when it is not needed:

enum _JNI_MyClass {
} // printJNICache(_:_:) @ JExtractSwiftLib/JNISwift2JavaGenerator+SwiftThunkPrinting.swift:181

This enum is only utilized for enums with associated values.
For all other classes, it remains empty.
This PR updates the generator to skip generating these enums when they are empty.

@sidepelican sidepelican requested a review from ktoso as a code owner April 9, 2026 01:37
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.

Thank you !

@ktoso ktoso merged commit c5bd059 into swiftlang:main Apr 9, 2026
64 checks passed
@sidepelican sidepelican deleted the small_improvements branch April 9, 2026 02:52
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.

2 participants