mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 06:11:42 +07:00
ConstantConditionalExpressionInspection: add cast if necessary when type changes
Fixes IDEA-194648 Simpler expression auto-fix results in different code
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
// "Simplify" "true"
|
||||
class Test {
|
||||
String test(String foo) {
|
||||
/*always false?*/
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Simplify" "true"
|
||||
class Test {
|
||||
int test(int a, int b) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Simplify" "true"
|
||||
class Test {
|
||||
public static void main(String[] args) {
|
||||
int i = 0;
|
||||
System.out.println((int) 'x');
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Simplify" "true"
|
||||
class Test {
|
||||
String test(String foo) {
|
||||
return (false/*always false?*/) ? foo<caret> : null;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Simplify" "true"
|
||||
class Test {
|
||||
int test(int a, int b) {
|
||||
return true<caret>?a:b;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Simplify" "true"
|
||||
class Test {
|
||||
public static void main(String[] args) {
|
||||
int i = 0;
|
||||
System.out.println(false <caret>? i : 'x');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user