Java: Quick fix for missing 'return' in lambda body (IDEA-169551)

This commit is contained in:
Pavel Dolgov
2019-02-20 13:27:57 +03:00
parent 783faded4b
commit ec58711cf3
16 changed files with 237 additions and 20 deletions
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
return 0;
});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
return 1;
});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
return Math.max(1, 2);
});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
return Math.max(1, 2);
});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
return Math.max(1, 2); //comment
});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
return Math.max(1,/*comment*/ 2);
});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,13 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
<caret>});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
1
<caret>});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
Math.max(1, 2)
<caret>});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
Math.max(1, 2);
<caret>});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
Math.max(1, 2) //comment
<caret>});
}
void bar(I i) {}
interface I {
int f();
}
}
@@ -0,0 +1,14 @@
// "Add 'return' statement" "true"
class C {
void foo() {
bar(() -> {
Math.max(1,/*comment*/ 2);
<caret>});
}
void bar(I i) {}
interface I {
int f();
}
}