summaryrefslogtreecommitdiff
path: root/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/equals_with_itself/EqualsWithItself.java
blob: 03347da345a5881c8915cb8d297d25722da40268 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class EqualsWithItself {

  boolean foo(Object o) {
    return o.<warning descr="Identical qualifier and argument to 'equals()' call">equals</warning>(((o)));
  }

  boolean withGetter() {
    return getValue().<warning descr="Identical qualifier and argument to 'equals()' call">equals</warning>(getValue());
  }

  boolean withMethodCall() {
    return build().equals(build());
  }

  private Integer value = 1;
  public Integer getValue() {
    return value;
  }

  public Object build() {
    return new Object();
  }
}