mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
relax "!null" contract checking to accept exceptions thrown (IDEA-133488)
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class Foo {
|
||||
|
||||
@Contract(value = "_, true -> !null")
|
||||
public @Nullable String noNotAllowed(@NotNull String bar, boolean reallyNotAllowed) {
|
||||
if (bar.equals("no")) {
|
||||
if (reallyNotAllowed) {
|
||||
throw new IllegalArgumentException("heck no");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return bar;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user