-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #11712: Support yield in FallThrough
- Loading branch information
Showing
7 changed files
with
76 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...mpilable/com/puppycrawl/tools/checkstyle/checks/coding/fallthrough/InputFallThrough3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
FallThrough | ||
checkLastCaseGroup = (default)false | ||
reliefPattern = (default)falls?[ -]?thr(u|ough) | ||
*/ | ||
|
||
//non-compiled with javac: Compilable with Java14 | ||
package com.puppycrawl.tools.checkstyle.checks.coding.fallthrough; | ||
|
||
public class InputFallThrough3 | ||
{ | ||
int hasYield() { | ||
int i = 0; | ||
return switch (hashCode()) { | ||
case 1: | ||
i++; | ||
case 2: // violation 'Fall through from previous branch of the switch statement.' | ||
yield 2; | ||
case 3: // ok | ||
// fall through | ||
case 4: // ok | ||
default: // ok | ||
yield -1; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters