mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
lambda: skip lambda return statements during wrapping method return values (IDEA-91065)
This commit is contained in:
+4
@@ -317,6 +317,10 @@ public class WrapReturnValueProcessor extends FixableUsagesRefactoringProcessor
|
||||
myMethod = psiMethod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLambdaExpression(PsiLambdaExpression expression) {
|
||||
}
|
||||
|
||||
public void visitReturnStatement(PsiReturnStatement statement) {
|
||||
super.visitReturnStatement(statement);
|
||||
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
class Test {
|
||||
Wrapper foo() {
|
||||
return new Wrapper((o) -> {
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
public class Wrapper {
|
||||
private final Comparable<String> value;
|
||||
|
||||
public Wrapper(Comparable<String> value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
public Comparable<String> getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
Comparable<String> foo() {
|
||||
return (o) -> {
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -124,4 +124,8 @@ public class WrapReturnValueTest extends MultiFileTestCase{
|
||||
doTest(true, "Existing class does not have appropriate constructor");
|
||||
}
|
||||
|
||||
public void testReturnInsideLambda() throws Exception {
|
||||
doTest(false, null, true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user