-
Notifications
You must be signed in to change notification settings - Fork 744
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
[Refactoring] Replace normal switches with enhanced switch expressions #42955
[Refactoring] Replace normal switches with enhanced switch expressions #42955
Conversation
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Remove stale status |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
29fdc3f
to
893002d
Compare
893002d
to
1ca947f
Compare
Failing testcase in Ballerina Distribution:
I dont think this is related to this PR |
Purpose
Many existing switch statements are essentially simulations of switch expressions, where each arm either assigns to a common target variable or returns a value. Expressing this as a statement is roundabout, repetitive, and error-prone.
Java 14 added support for switch expressions, which provide more succinct and less error-prone version of switch.
See also: https://sonarcloud.io/organizations/ballerina-platform/rules?languages=java&open=java%3AS5194&q=switch+expression
Partly also fixes: https://sonarcloud.io/organizations/ballerina-platform/rules?open=java%3AS6208&rule_key=java%3AS6208
Approach
Samples
Remarks
Check List