summaryrefslogtreecommitdiff
path: root/java/java-tests/testData/inspection/dataFlow/fixture/RootThrowableCause.java
blob: 1197fe817e8e4c0a48352865db91c283fbe0e1d0 (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
25
26
27
28
29
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Nullable;

class Doo {

  void foo(Throwable e) {
    Throwable t = e;

    while (t.getCause() != null) t = t.getCause();
    if (e != t) {
      System.out.println();
    }
  }

}

abstract class Test04 {
  @Nullable
  @Contract(pure = true)
  abstract Test04 getParent();

  Test04 getTopParent() {
    Test04 top = this;
    while (top.getParent() != null) {
      top = top.getParent();
    }
    return top;
  }
}