Repository navigation
JNI: Java enum constants keep the Swift case names - #23
Open
piercifani wants to merge 2 commits into
Open
piercifani wants to merge 2 commits into
piercifani wants to merge 2 commits into
Conversation
With `payloadlessEnumsAsJavaEnums`, constants were uppercased like the `Discriminator` of enum classes: `OrderStatus.FILLED`. They now keep the case name, `OrderStatus.filled`, as Swift code spells it and as the case factory method `filled()` already does. Kotlin code written against the Swift API, or translated from it, uses the same names. A case named after a Java keyword, such as `` `default` ``, gets a trailing `_`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack 19/21 · base:
jni/18-async-closures· previous: #22 · next: #24 (jni/20-nullability-annotations)Problem
With
payloadlessEnumsAsJavaEnums(#17), Java enum constants were uppercased, like theDiscriminatorof enum classes:OrderStatus.FILLED. Swift code spells the case.filled, and so does Kotlin code written against the Swift API or translated from it.Changes
OrderStatus.filled, matching the case factory methodfilled()they sit next to.`default`, gets a trailing_, as methods already do.payloadlessEnumsAsJavaEnums' documentation says how constants are named.Discriminator, on enum classes, keeps its uppercase names.Kotlin in this PR
JavaEnumsTest.ktuses the Swift names:Why Skip needs it
Skip keeps Swift's case names in the Kotlin
enum classes it generates, and the app's Kotlin code refers to them by those names.Testing
JavaEnumsTestpasses with the Swift names, as does the full Kotlin sample (47 tests).JNIJavaEnumTests: constants named like the cases; a new test for`default`→default_.swift test --disable-experimental-prebuilts --disable-sandbox(690 tests) and./gradlew :Samples:SwiftJavaExtractJNISampleApp:test(302 tests) pass, measured with the next PR applied.swift run generate-config-docs --check;swift format formatleaves changed files unchanged;git diff --check.🤖 Generated with Claude Code