UseEnumSwitch - detection edge case (false positive)
Open
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
```java
interface Foo {
void foo();
}
enum Bar implements Foo {
Bar1, Bar2, Bar3;
void foo() { /* do something */ }
}
enum Baz implements Foo {
Baz1, Baz2, Baz3;
void foo() { /* do something else */ }
}
```
Both enums implement an interface but code like this can't be turned into an enum switch because they are two different enums:
```java
final Foo quux = getAFoo();
if (quux == Bar.Bar1) { /* some code */ }
else if(quux == Baz.Baz1) { /* some code */ }
else if(quux == Baz.Baz2) { /* some code */ }
```
Contributor guide
Assessment
This issue has not been assessed yet.