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

Disable FallThrough on Java 14 for switch expressions #1442

Merged
merged 3 commits into from
Jul 1, 2020

Conversation

pkoenig10
Copy link
Member

@pkoenig10 pkoenig10 commented Jun 30, 2020

Related to #1413

Before this PR

There is a false negative with FallThrough on Java 14 when using switch expressions where the case arms are statements (as opposed to expressions).

See google/error-prone#1649.

After this PR

Disable FallThrough on Java 14.

@changelog-app
Copy link

changelog-app bot commented Jun 30, 2020

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Disable FallThrough on Java 14 source to avoid false positives

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from dansanduleac June 30, 2020 20:47
" };",
" }",
"}")
.expectErrorMessage("X", input -> input.contains("Execution may fall through from the previous case"))
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to use Diagnostic matches and expectErrorMessage because otherwise the diagnostic message matches the magic comment that will suppress the check.
https://github.com/google/error-prone/blob/v2.4.0/core/src/main/java/com/google/errorprone/bugpatterns/FallThrough.java#L45-L46

@ferozco
Copy link
Contributor

ferozco commented Jul 1, 2020

👍

@bulldozer-bot bulldozer-bot bot merged commit aa4bb4b into develop Jul 1, 2020
@bulldozer-bot bulldozer-bot bot deleted the pkoenig/fallthrough branch July 1, 2020 13:52
@svc-autorelease
Copy link
Collaborator

Released 3.33.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants