IDEA-240285 ConstantConditions: improve detection of pointless 'Math.min' and 'Math.max' operations

+Quick-fix

GitOrigin-RevId: 9f01fac2ecd4faf7ff76101a956cc30582ad421b
This commit is contained in:
Tagir Valeev
2020-05-12 08:00:09 +00:00
committed by intellij-monorepo-bot
parent 852f9f04d7
commit 7b5c5c2875
15 changed files with 225 additions and 19 deletions
@@ -0,0 +1,7 @@
// "Replace with 'x'" "true"
class X {
void test(int x, int y) {
if (x != y) return;
System.out.println(x);
}
}
@@ -0,0 +1,7 @@
// "Replace with 'y'" "true"
class X {
void test(int x, int y) {
if (x > y) return;
System.out.println(y);
}
}
@@ -0,0 +1,7 @@
// "Replace with 'x'" "true"
class X {
void test(int x, int y) {
if (x != y) return;
System.out.println(Math.<caret>max(x, y));
}
}
@@ -0,0 +1,7 @@
// "Replace with 'y'" "true"
class X {
void test(int x, int y) {
if (x > y) return;
System.out.println(Math.<caret>max(x, y));
}
}