Skip to content

jextract/jni: Use switch expressions in getCase()#717

Merged
ktoso merged 1 commit intoswiftlang:mainfrom
sidepelican:switch_expr
Apr 22, 2026
Merged

jextract/jni: Use switch expressions in getCase()#717
ktoso merged 1 commit intoswiftlang:mainfrom
sidepelican:switch_expr

Conversation

@sidepelican
Copy link
Copy Markdown
Contributor

Using a switch expression for the Case getCase() implementation makes the code cleaner.
Since switch expressions are exhaustive, it eliminates the need to throw a RuntimeException.

@sidepelican sidepelican requested a review from ktoso as a code owner April 22, 2026 01:21
@ktoso
Copy link
Copy Markdown
Collaborator

ktoso commented Apr 22, 2026

Oh wait... which java source version does this require...

@sidepelican
Copy link
Copy Markdown
Contributor Author

It became available in Java 14, and given the current use of sealed classes, I believe this is perfectly acceptable.

@ktoso
Copy link
Copy Markdown
Collaborator

ktoso commented Apr 22, 2026

Sweet, I was just checking now -- 14 is perfectly fine :-)
Thank you

@ktoso ktoso merged commit eca2feb into swiftlang:main Apr 22, 2026
64 checks passed
@sidepelican sidepelican deleted the switch_expr branch April 22, 2026 02:02
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