mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-17 11:40:50 +07:00
37 lines
770 B
Java
37 lines
770 B
Java
import org.jetbrains.annotations.*;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import java.util.List;
|
|
|
|
class TestIDEAWarn {
|
|
void method(@Nullable MyEnum e) {
|
|
if (e != MyEnum.foo) {return;}
|
|
System.out.println(e.hashCode());
|
|
}
|
|
void method2(@Nullable MyEnum e) {
|
|
if (e == MyEnum.foo) {
|
|
System.out.println(e.hashCode());
|
|
}
|
|
}
|
|
void method3(@Nullable MyEnum e) {
|
|
if (MyEnum.foo == e) {
|
|
System.out.println(e.hashCode());
|
|
}
|
|
}
|
|
|
|
void test(List items) {
|
|
MyEnum status = calcPodFileStatus();
|
|
|
|
if (status == MyEnum.foo && items.isEmpty()) {
|
|
return;
|
|
}
|
|
|
|
status.toString(); // false NPE warning here
|
|
}
|
|
|
|
@NotNull
|
|
private static MyEnum calcPodFileStatus() {
|
|
return MyEnum.foo;
|
|
}
|
|
}
|
|
enum MyEnum { foo, bar } |