mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-146122 Wrong 'can produce NPE' after comparing with enum constant
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
enum MyEnum {
|
||||
ITEM,
|
||||
ANOTHER_ITEM,
|
||||
LOL_ITEM;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"UseOfSystemOutOrSystemErr", "unused"})
|
||||
class Main {
|
||||
void foo(@Nullable MyEnum myEnum) {
|
||||
if (myEnum == null) return;
|
||||
switch (myEnum) {
|
||||
case ITEM:
|
||||
case ANOTHER_ITEM:
|
||||
System.out.println(myEnum == MyEnum.ITEM ? "item" : "another");
|
||||
myEnum.name();
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user