Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle case null in switch statements #1100

Merged
merged 1 commit into from
Dec 18, 2024
Merged

Handle case null in switch statements #1100

merged 1 commit into from
Dec 18, 2024

Conversation

msridhar
Copy link
Collaborator

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

Fixes #930

@@ -207,7 +207,7 @@ public void cfNullableArrayField() {
}

@Test
public void supportSwitchExpression() {
public void switchOnNullable() {
Copy link
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

Copy link

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
11 checks passed
@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