mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 23:39:39 +07:00
26 lines
514 B
Java
26 lines
514 B
Java
import org.springframework.util.Assert;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
class Contracts {
|
|
|
|
void foo(Object o) {
|
|
Assert.isTrue(o instanceof String);
|
|
String s = (String) o;
|
|
}
|
|
|
|
void foo1(Object o) {
|
|
Assert.state(o instanceof String, "oops");
|
|
String s = (String) o;
|
|
}
|
|
|
|
void foo2(@Nullable Object o) {
|
|
Assert.notNull(o);
|
|
System.out.println(o.hashCode());
|
|
}
|
|
|
|
void foo3(@Nullable Object o) {
|
|
Assert.notNull(o, "not null");
|
|
System.out.println(o.hashCode());
|
|
}
|
|
|
|
} |