Files
openide/java/java-tests/testData/inspection/manualMinMaxCalculation/afterVariableValueUsed.java
Bas Leijdekkers 62e3f683ec Don't remove variable assignment in "Manual min/max calculation" inspection fix (IDEA-291924)
GitOrigin-RevId: f30aacee58cb79e738e79327f586cd371338a6ed
2022-04-14 23:53:12 +00:00

23 lines
438 B
Java

// "Replace with 'Math.min()' call" "true"
import java.util.Random;
class VariableValueUsed {
private static final Random rnd = new Random();
private static int test() {
return rnd.nextInt();
}
public static void main(String[] args) {
int l = 2;
int myNumber = test();
/*3*/
/*1*/
/*2*/
/*5*/
myNumber = Math.min(l +/*6*/1, myNumber/*4*/ - 2);
System.out.println(myNumber);
}
}