Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/EqualsWithItself.java
2018-08-08 16:39:40 +07:00

24 lines
578 B
Java

import java.util.List;
class Test {
void test(Object x, Object y) {
if(x.equals(x)) {
// do not report here; reported by EqualsWithItselfInspection
System.out.println("always");
}
if(!x.equals(x)) {
// do not report here; reported by EqualsWithItselfInspection
System.out.println("never");
}
y = x;
if(<warning descr="Condition 'x.equals(y)' is always 'true'">x.equals(y)</warning>) {
System.out.println("always");
}
}
void test(Boolean x) {
if(x.equals(true)) {
System.out.println("oops");
}
}
}