HighlightUtil: suggest fix for cases when method has void return type and return statement value type is unknown (IDEA-216279)

GitOrigin-RevId: 2af7ce37a427c8ec6f5175fc820ec0eecbf719c9
This commit is contained in:
Artemiy Sartakov
2019-07-02 06:52:16 +03:00
committed by intellij-monorepo-bot
parent 6742e9aab5
commit 8ec9a2e0ce
20 changed files with 274 additions and 15 deletions
@@ -0,0 +1,7 @@
// "Delete return statement" "true"
class Test {
void foo(boolean b) {
}
}
@@ -0,0 +1,9 @@
// "Delete return value '"foo"'" "true"
class Test {
void foo(boolean b) {
if (b) return;
System.out.println("bar");
}
}
@@ -0,0 +1,7 @@
// "Delete return statement" "true"
class Test {
void foo(boolean b) {
}
}
@@ -0,0 +1,9 @@
// "Delete return value 'null'" "true"
class Test {
void foo(boolean b) {
if (b) return;
System.out.println("bar");
}
}
@@ -0,0 +1,8 @@
// "Delete return statement" "true"
class Test {
void foo(boolean b) {
return<caret> "foo";
}
}
@@ -0,0 +1,12 @@
// "Delete return statement" "false"
class Test {
void foo(boolean b) {
return<caret> getWithSideEffects();
}
private String getWithSideEffects() {
System.out.println("baz");
}
}
@@ -0,0 +1,9 @@
// "Delete return value '"foo"'" "true"
class Test {
void foo(boolean b) {
if (b) return<caret> "foo";
System.out.println("bar");
}
}
@@ -0,0 +1,13 @@
// "Delete return statement" "false"
class Test {
void foo(boolean b) {
if (b) return<caret> getWithSideEffects();
System.out.println("bar");
}
private String getWithSideEffects() {
System.out.println("baz");
}
}
@@ -0,0 +1,8 @@
// "Delete return statement" "true"
class Test {
void foo(boolean b) {
return<caret> null;
}
}
@@ -0,0 +1,9 @@
// "Delete return value 'null'" "true"
class Test {
void foo(boolean b) {
if (b) return<caret> null;
System.out.println("bar");
}
}
@@ -0,0 +1,8 @@
// "Change return type for method 'foo'" "true"
class Test {
<caret><selection>void</selection> foo() {
return null;
}
}
@@ -0,0 +1,8 @@
// "Change return type for method 'foo'" "true"
class Test {
void foo() {
return <caret>null;
}
}