Files
Tagir Valeevandintellij-monorepo-bot d7767eab92 [java-dfa] IDEA-364131 Inline overridable trivial accessors if the exact qualifier type is known
Getter inlining functionality moved to MethodCallInstruction

Also: get rid of MethodCallInstruction.myPrecalculatedReturnValue. In any case, we do a lot of ad-hoc computations inside MethodCallInstruction. So we can move two cases when myPrecalculatedReturnValue was used (getter processing and empty collection processing) into MethodCallInstruction as well. This unifies code a little, and provides more possibilities, as we know current abstract interpretation state and can use it (in particular, stability of qualifier)

Also: a new kind of MutationSignature 'transparent', which doesn't flush even private fields. It's not exposed to public annotations yet (appears to the user in the same way as 'pure')

GitOrigin-RevId: 548ab12afc0d0314829f47e0ef51caec59985698
2024-12-02 14:43:44 +00:00

38 lines
742 B
Java

import java.util.*;
import org.jetbrains.annotations.*;
class Test {
private int x, y;
int getX() {
return x;
}
int getY() {
return y;
}
static void test(Test t) {
if (t.getX() == t.getY()) {
if (t.x == t.y) { // Who knows, probably subclass
}
}
if (t.getClass() == Test.class) {
if (t.getX() == t.getY()) {
if (<warning descr="Condition 't.x == t.y' is always 'true'">t.x == t.y</warning>) { // Definitely not subclass
}
}
}
}
static void test2() {
Test t = new Test();
if (t.getX() == t.getY()) {
if (<warning descr="Condition 't.x == t.y' is always 'true'">t.x == t.y</warning>) { // Definitely not subclass
}
}
}
}