forked from typetools/checker-framework
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix rules for switch statement exhaustiveness (#620)
- Loading branch information
Showing
5 changed files
with
74 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Test case for EISOP issue #609: | ||
// https://github.com/eisop/checker-framework/issues/609 | ||
enum EnumSwitch { | ||
FOO; | ||
|
||
EnumSwitch getIt() { | ||
return FOO; | ||
} | ||
|
||
String go() { | ||
EnumSwitch e = getIt(); | ||
switch (e) { | ||
case FOO: | ||
return "foo"; | ||
} | ||
// This location is reachable in general: the enum could evolve and add a new constant. | ||
// This cannot be the case here, because this code is in the enum declaration. | ||
// javac does not special case this and I do not see a reason to do so here. | ||
throw new AssertionError(e); | ||
} | ||
} |
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