mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-17 06:49:59 +07:00
HighlightUtil: cr fixes (IDEA-CR-48700):
- extract side effects when removing return statement - suggest to replace void with Object in case when null is returned - generateReturnValueFromVoidMethodInfo -> registerReturnValueFixes GitOrigin-RevId: 0b068f00758fb1fd521f76a1da6964e114ef0853
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cd01ec6325
commit
117357c4db
+12
@@ -0,0 +1,12 @@
|
||||
// "Delete return statement and extract side effects" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
void foo(boolean b) {
|
||||
getWithSideEffects(/*2*/);/*1*/
|
||||
}
|
||||
|
||||
private String getWithSideEffects() {
|
||||
System.out.println("baz");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Delete return value '"foo"'" "true"
|
||||
// "Delete return value" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Delete return value and extract side effects" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
void foo(boolean b) {
|
||||
if (b) /*1*/ {
|
||||
getWithSideEffects(/*3*/);
|
||||
return /*2*/;
|
||||
}
|
||||
System.out.println("bar");
|
||||
}
|
||||
|
||||
private String getWithSideEffects() {
|
||||
System.out.println("baz");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Delete return value 'null'" "true"
|
||||
// "Delete return value" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// "Delete return statement" "false"
|
||||
// "Delete return statement and extract side effects" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
void foo(boolean b) {
|
||||
return<caret> getWithSideEffects();
|
||||
return/*1*/<caret> getWithSideEffects(/*2*/);
|
||||
}
|
||||
|
||||
private String getWithSideEffects() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Delete return value '"foo"'" "true"
|
||||
// "Delete return value" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// "Delete return statement" "false"
|
||||
// "Delete return value and extract side effects" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
void foo(boolean b) {
|
||||
if (b) return<caret> getWithSideEffects();
|
||||
if (b) /*1*/return ("foo"/*2*/) + <caret>getWithSideEffects(/*3*/);
|
||||
System.out.println("bar");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Delete return value 'null'" "true"
|
||||
// "Delete return value" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Make 'foo' return 'java.lang.Object'" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
<caret><selection>Object</selection> foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
// "Change return type for method 'foo'" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
<caret><selection>void</selection> foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type for method 'foo'" "true"
|
||||
// "Make 'foo' return 'java.lang.Object'" "true"
|
||||
|
||||
class Test {
|
||||
|
||||
Reference in New Issue
Block a user