summaryrefslogtreecommitdiff
path: root/java/java-tests/testData/inspection/dataFlow/fixture/ContractWithNoArgs.java
blob: 006c2e3407ecfebce60dd2dc4f8e092e3d98b3de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

class Doo {

  @NotNull
  public String doSomething() {
    String s = getSomeString();
    if (s == null) {
      throwSomeError();
    }
    return s;
  }

  private static void throwSomeError() {
    throw new RuntimeException();
  }

  @Nullable
  public String getSomeString() {
    return Math.random() > 0.5 ? null : "Yeah";
  }

}