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

StatementSwitchToExpressionSwitch: only trigger on compatible target versions #3657

Closed
wants to merge 0 commits into from

Conversation

copybara-service[bot]
Copy link
Contributor

StatementSwitchToExpressionSwitch: only trigger on compatible target versions

This change introduces a SourceVersion utility class, analogous to the
existing RuntimeVersion class. The new class tells whether selected language
features are available for the source version used by the compiler.

The new utility class is used to make sure that
StatementSwitchToExpressionSwitch flags statement switches only if the source
version supports expression switches, irrespective of whether the current
runtime supports such switch types. Concretely this makes the check compatible
with projects that target JDK 11, yet support building with JDK 17.

Fixes #3646

FUTURE_COPYBARA_INTEGRATE_REVIEW=#3646 from PicnicSupermarket:bugfix/dont-suggest-switch-expressions-pre-jdk14 641c9dc

@copybara-service copybara-service bot closed this Jan 2, 2023
@copybara-service copybara-service bot deleted the test_498755371 branch January 2, 2023 22:55
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.

0 participants