mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Java inspection: Supported switch in "Move return to computation", preserve comments (IDEA-121153)
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a[]) {
|
||||
int n = 0;
|
||||
for (int i=0; i<a.length; i++) {
|
||||
if (n < a[i]) n = a[i];
|
||||
if (n > 100) {
|
||||
return n; // at the end 1
|
||||
}
|
||||
if (n < 0) {
|
||||
return 0; // at the end 2
|
||||
/* inline */
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Move 'return' to computation of the value of 's'" "true"
|
||||
class T {
|
||||
int f(String a) {
|
||||
String s = a;
|
||||
if (s == null) {
|
||||
return ""; /* return comment */ // end of line
|
||||
}
|
||||
else if (s.startsWith("@")) {
|
||||
return s.substring(1); // return comment
|
||||
}
|
||||
else if (s.startsWith("#")) {
|
||||
return "#"; /* return comment */ /* inline */
|
||||
}
|
||||
return s; // return comment
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Move 'return' to computation of the value of 'n'" "true"
|
||||
class T {
|
||||
int f(int a[]) {
|
||||
int n = 0;
|
||||
for (int i=0; i<a.length; i++) {
|
||||
if (n < a[i]) n = a[i];
|
||||
if (n > 100) {
|
||||
break; // at the end 1
|
||||
}
|
||||
if (n < 0) {
|
||||
n = 0; // at the end 2
|
||||
break; /* inline */
|
||||
}
|
||||
}
|
||||
ret<caret>urn n;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Move 'return' to computation of the value of 's'" "true"
|
||||
class T {
|
||||
int f(String a) {
|
||||
String s = a;
|
||||
if (s == null) {
|
||||
s = ""; // end of line
|
||||
}
|
||||
else if (s.startsWith("@")) {
|
||||
s = s.substring(1);
|
||||
}
|
||||
else if (s.startsWith("#")) {
|
||||
s = "#"; /* inline */
|
||||
}
|
||||
ret<caret>urn s; // return comment
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user