-
Notifications
You must be signed in to change notification settings - Fork 2k
Java: Limit the amount of results that MissingEnumInSwitch produces per switch #15961
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
916b1e9
Java: Add a test for MissingEnumInSwitch
igfoo 60b5e49
Java: Limit the amount of results that MissingEnumInSwitch produces p…
igfoo 59ae6dd
Java: Add a couple of Oxford commas
igfoo fda3c92
Java: Add a changenote for the MissingEnumInSwitch change
igfoo b6a1266
Java: Accept test changes for MissingEnumInSwitch Oxford commas
igfoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
10 changes: 10 additions & 0 deletions
10
.../test/query-tests/Likely Bugs/Statements/MissingEnumInSwitch/MissingEnumInSwitch.expected
This file contains hidden or 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,10 @@ | ||
| | Test.java:8:5:8:13 | switch (...) | Switch statement does not have a case for $@, $@, $@ or 22 more. | Test.java:4:27:4:27 | B | B | Test.java:4:25:4:25 | C | C | Test.java:4:45:4:45 | D | D | | ||
| | Test.java:11:5:11:13 | switch (...) | Switch statement does not have a case for $@, $@, $@ or 21 more. | Test.java:4:25:4:25 | C | C | Test.java:4:45:4:45 | D | D | Test.java:4:15:4:15 | E | E | | ||
| | Test.java:15:5:15:13 | switch (...) | Switch statement does not have a case for $@, $@, $@ or 20 more. | Test.java:4:45:4:45 | D | D | Test.java:4:15:4:15 | E | E | Test.java:4:43:4:43 | F | F | | ||
| | Test.java:20:5:20:13 | switch (...) | Switch statement does not have a case for $@, $@, $@ or 19 more. | Test.java:4:15:4:15 | E | E | Test.java:4:43:4:43 | F | F | Test.java:4:49:4:49 | G | G | | ||
| | Test.java:26:5:26:13 | switch (...) | Switch statement does not have a case for $@, $@, $@ or 18 more. | Test.java:4:43:4:43 | F | F | Test.java:4:49:4:49 | G | G | Test.java:4:35:4:35 | H | H | | ||
| | Test.java:33:5:33:13 | switch (...) | Switch statement does not have a case for $@, $@, $@ or 2 more. | Test.java:4:21:4:21 | V | V | Test.java:4:13:4:13 | W | W | Test.java:4:23:4:23 | X | X | | ||
| | Test.java:56:5:56:13 | switch (...) | Switch statement does not have a case for $@, $@, $@ or 1 more. | Test.java:4:13:4:13 | W | W | Test.java:4:23:4:23 | X | X | Test.java:4:11:4:11 | Y | Y | | ||
| | Test.java:80:5:80:13 | switch (...) | Switch statement does not have a case for $@, $@ or $@. | Test.java:4:23:4:23 | X | X | Test.java:4:11:4:11 | Y | Y | Test.java:4:33:4:33 | Z | Z | | ||
| | Test.java:105:5:105:13 | switch (...) | Switch statement does not have a case for $@ or $@. | Test.java:4:11:4:11 | Y | Y | Test.java:4:33:4:33 | Z | Z | Test.java:4:11:4:11 | Y | Y | | ||
| | Test.java:131:5:131:13 | switch (...) | Switch statement does not have a case for $@. | Test.java:4:33:4:33 | Z | Z | Test.java:4:33:4:33 | Z | Z | Test.java:4:33:4:33 | Z | Z | |
1 change: 1 addition & 0 deletions
1
.../ql/test/query-tests/Likely Bugs/Statements/MissingEnumInSwitch/MissingEnumInSwitch.qlref
This file contains hidden or 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 @@ | ||
| Likely Bugs/Statements/MissingEnumInSwitch.ql |
187 changes: 187 additions & 0 deletions
187
java/ql/test/query-tests/Likely Bugs/Statements/MissingEnumInSwitch/Test.java
This file contains hidden or 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,187 @@ | ||
| public class Test { | ||
| private enum MyEnum { | ||
| // A..Z in random order | ||
| N,R,S,Y,W,E,K,I,V,X,C,B,O,J,Z,H,T,P,A,F,D,M,G,U,L,Q | ||
| } | ||
|
|
||
| public void use(MyEnum e) { | ||
| switch(e) { | ||
| case A: break; | ||
| } | ||
| switch(e) { | ||
| case A: break; | ||
| case B: break; | ||
| } | ||
| switch(e) { | ||
| case A: break; | ||
| case B: break; | ||
| case C: break; | ||
| } | ||
| switch(e) { | ||
| case A: break; | ||
| case B: break; | ||
| case C: break; | ||
| case D: break; | ||
| } | ||
| switch(e) { | ||
| case A: break; | ||
| case B: break; | ||
| case C: break; | ||
| case D: break; | ||
| case E: break; | ||
| } | ||
| switch(e) { | ||
| case A: break; | ||
| case B: break; | ||
| case C: break; | ||
| case D: break; | ||
| case E: break; | ||
| case F: break; | ||
| case G: break; | ||
| case H: break; | ||
| case I: break; | ||
| case J: break; | ||
| case K: break; | ||
| case L: break; | ||
| case M: break; | ||
| case N: break; | ||
| case O: break; | ||
| case P: break; | ||
| case Q: break; | ||
| case R: break; | ||
| case S: break; | ||
| case T: break; | ||
| case U: break; | ||
| } | ||
| switch(e) { | ||
| case A: break; | ||
| case B: break; | ||
| case C: break; | ||
| case D: break; | ||
| case E: break; | ||
| case F: break; | ||
| case G: break; | ||
| case H: break; | ||
| case I: break; | ||
| case J: break; | ||
| case K: break; | ||
| case L: break; | ||
| case M: break; | ||
| case N: break; | ||
| case O: break; | ||
| case P: break; | ||
| case Q: break; | ||
| case R: break; | ||
| case S: break; | ||
| case T: break; | ||
| case U: break; | ||
| case V: break; | ||
| } | ||
| switch(e) { | ||
| case A: break; | ||
| case B: break; | ||
| case C: break; | ||
| case D: break; | ||
| case E: break; | ||
| case F: break; | ||
| case G: break; | ||
| case H: break; | ||
| case I: break; | ||
| case J: break; | ||
| case K: break; | ||
| case L: break; | ||
| case M: break; | ||
| case N: break; | ||
| case O: break; | ||
| case P: break; | ||
| case Q: break; | ||
| case R: break; | ||
| case S: break; | ||
| case T: break; | ||
| case U: break; | ||
| case V: break; | ||
| case W: break; | ||
| } | ||
| switch(e) { | ||
| case A: break; | ||
| case B: break; | ||
| case C: break; | ||
| case D: break; | ||
| case E: break; | ||
| case F: break; | ||
| case G: break; | ||
| case H: break; | ||
| case I: break; | ||
| case J: break; | ||
| case K: break; | ||
| case L: break; | ||
| case M: break; | ||
| case N: break; | ||
| case O: break; | ||
| case P: break; | ||
| case Q: break; | ||
| case R: break; | ||
| case S: break; | ||
| case T: break; | ||
| case U: break; | ||
| case V: break; | ||
| case W: break; | ||
| case X: break; | ||
| } | ||
| switch(e) { | ||
| case A: break; | ||
| case B: break; | ||
| case C: break; | ||
| case D: break; | ||
| case E: break; | ||
| case F: break; | ||
| case G: break; | ||
| case H: break; | ||
| case I: break; | ||
| case J: break; | ||
| case K: break; | ||
| case L: break; | ||
| case M: break; | ||
| case N: break; | ||
| case O: break; | ||
| case P: break; | ||
| case Q: break; | ||
| case R: break; | ||
| case S: break; | ||
| case T: break; | ||
| case U: break; | ||
| case V: break; | ||
| case W: break; | ||
| case X: break; | ||
| case Y: break; | ||
| } | ||
| switch(e) { | ||
| case A: break; | ||
| case B: break; | ||
| case C: break; | ||
| case D: break; | ||
| case E: break; | ||
| case F: break; | ||
| case G: break; | ||
| case H: break; | ||
| case I: break; | ||
| case J: break; | ||
| case K: break; | ||
| case L: break; | ||
| case M: break; | ||
| case N: break; | ||
| case O: break; | ||
| case P: break; | ||
| case Q: break; | ||
| case R: break; | ||
| case S: break; | ||
| case T: break; | ||
| case U: break; | ||
| case V: break; | ||
| case W: break; | ||
| case X: break; | ||
| case Y: break; | ||
| case Z: break; | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.