summaryrefslogtreecommitdiff
path: root/java/java-tests/testData/inspection/dataFlow/fixture/FinalFieldsInitializedNotNull.java
blob: 7760a8fc65956b124c0fe661b067ff4e746a322c (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
30
31
32
33
34
35
import java.lang.IllegalArgumentException;
import java.lang.Object;

class Doo {
  private final Object myA;
  private final Object myB;
  private final Object myC;

  public Doo(Object myA, Object myB, Object c) {
    if (myB == null) {
//      assert myA != null;
      throw new IllegalArgumentException();
    }
    assert c != null;
    this.myA = myA;
    this.myB = myB;
    myC = c;
  }

  int bar() {
    return myC.hashCode();
  }


  int foo() {
    if (<warning descr="Condition 'myB == null' is always 'false'">myB == null</warning>) {
      return 2;
    }
    if (<warning descr="Condition 'myC != null' is always 'true'">myC != null</warning>) {
      return 3;
    }

    return myA.hashCode();
  }
}