IDEA-231280 Quick fix for compare() method can be used to compare numbers generates broken code

Also declaration is joined automatically

GitOrigin-RevId: f94ddf5ae3e94edffdb44cd56ad6bf8b3a9054b4
This commit is contained in:
Tagir Valeev
2020-01-24 13:01:07 +07:00
committed by intellij-monorepo-bot
parent e512fa3c6a
commit 619bfa9963
4 changed files with 30 additions and 8 deletions

View File

@@ -1,9 +1,8 @@
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
class Test {
public void test(String s1, String s2) {
int res;
res = Integer.compare(s2.length(), s1.length())
System.out.println(res);
int res = Integer.compare(s2.length(), s1.length());
System.out.println(res);
}
public void testMissingElse(String s1, String s2) {

View File

@@ -0,0 +1,7 @@
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
class Test {
public static int _compare(int mask1, int mask2) {
int compareResult = Integer.compare(mask1, mask2);
return compareResult;
}
}

View File

@@ -0,0 +1,14 @@
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
class Test {
public static int _compare(int mask1, int mask2) {
int compareResult;
i<caret>f (mask1 > mask2) {
compareResult = 1;
} else if (mask1 == mask2) {
compareResult = 0;
} else {
compareResult = -1;
}
return compareResult;
}
}