mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-17 21:15:58 +07:00
44 lines
1023 B
Java
44 lines
1023 B
Java
import org.jetbrains.annotations.Contract;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
class Foo {
|
|
|
|
public void main(@NotNull Object nn) {
|
|
foo(nn).hashCode();
|
|
}
|
|
|
|
@Contract("null->null;!null->!null")
|
|
@Nullable
|
|
Object foo(Object a) { return a; }
|
|
|
|
@NotNull
|
|
Object notNull() {
|
|
return <warning descr="Expression 'nullable(false)' might evaluate to null but is returned by the method declared as @NotNull">nullable(false)</warning>;
|
|
}
|
|
|
|
@NotNull
|
|
Object notNull2() {
|
|
return <warning descr="Expression 'nullable2(false)' might evaluate to null but is returned by the method declared as @NotNull">nullable2(false)</warning>;
|
|
}
|
|
|
|
@Nullable
|
|
@Contract("true -> !null")
|
|
Object nullable(boolean notNull) {
|
|
return notNull ? "" : anotherNullable();
|
|
}
|
|
|
|
@Nullable
|
|
@Contract("true -> !null; _->_")
|
|
Object nullable2(boolean notNull) {
|
|
return notNull ? "" : anotherNullable();
|
|
}
|
|
|
|
@Nullable
|
|
Object anotherNullable() {
|
|
return null;
|
|
}
|
|
|
|
}
|
|
|