Skip to content

Handle case null in switch statements#1100

Merged
msridhar merged 1 commit intomasterfrom
issue-930
Dec 18, 2024
Merged

Handle case null in switch statements#1100
msridhar merged 1 commit intomasterfrom
issue-930

Conversation

@msridhar
Copy link
Copy Markdown
Collaborator

In Java 21+, when a switch statement contains case null, the expression being switched on is allowed to be null.

Fixes #930


@Test
public void supportSwitchExpression() {
public void switchOnNullable() {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Rename to clarify what is being tested; this test was written before Java added switch expressions

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.11%. Comparing base (18c9723) to head (5816346).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1100   +/-   ##
=========================================
  Coverage     88.11%   88.11%           
- Complexity     2205     2206    +1     
=========================================
  Files            84       84           
  Lines          7175     7175           
  Branches       1423     1423           
=========================================
  Hits           6322     6322           
  Misses          430      430           
  Partials        423      423           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@msridhar msridhar merged commit 41c7c55 into master Dec 18, 2024
@msridhar msridhar deleted the issue-930 branch December 18, 2024 20:27
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.

False positive warning on switch statements with case null

2 participants