Skip to content

refactor: migrate switch statements to modern switch syntax (Java 14+)#1092

Merged
He-Pin merged 2 commits into
apache:mainfrom
He-Pin:feature/java17-switch-expression
Jun 26, 2026
Merged

refactor: migrate switch statements to modern switch syntax (Java 14+)#1092
He-Pin merged 2 commits into
apache:mainfrom
He-Pin:feature/java17-switch-expression

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Migrate switch statements to enhanced switch syntax and switch expressions (Java 14+ API)
  • 4 files updated: MarshallerTest (4 switches), OversizedSseStrategy, Jackson (jackson module), Jackson (jackson3 module)
  • Behavior-preserving refactoring, no functional changes

Test plan

  • Existing tests pass (behavior-preserving refactoring)
  • sbt javafmtAll passes with JDK 17

Motivation:
Java 14 introduced enhanced switch statements and switch expressions
with arrow syntax, eliminating fall-through bugs and reducing boilerplate.

Modification:
Convert switch statements to switch expressions and enhanced switch
statements in MarshallerTest, OversizedSseStrategy, and Jackson
marshaller classes.

Result:
Cleaner, more concise switch code with no fall-through risk.

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

javafmt broken

Motivation:
CI javafmt check failed on the switch expression migration PR.

Modification:
Run sbt javafmtAll to fix formatting in Jackson.java (jackson and
jackson3 modules) and MarshallerTest.java.

Result:
javafmt CI check passes.
@He-Pin
He-Pin requested a review from pjfanning June 26, 2026 04:35

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@He-Pin
He-Pin merged commit 1566cff into apache:main Jun 26, 2026
5 checks passed
@He-Pin
He-Pin deleted the feature/java17-switch-expression branch June 26, 2026 09:13
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