mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-22 07:32:21 +07:00
18 lines
551 B
Java
18 lines
551 B
Java
import org.jetbrains.annotations.Contract;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
class Foo {
|
|
@Contract("!null,true->!null")
|
|
String delegationToInstance(@NotNull Foo f, boolean createIfNeeded) {
|
|
return <warning descr="Contract clause '!null, true -> !null' is violated: exception might be thrown instead of returning !null">f.getString(createIfNeeded)</warning>;
|
|
}
|
|
|
|
@Contract("true->fail")
|
|
String getString(boolean fail) {
|
|
if (fail) throw new RuntimeException();
|
|
return "a";
|
|
}
|
|
|
|
}
|