lambda: skip lambda return statements during wrapping method return values (IDEA-91065)

This commit is contained in:
Anna Kozlova
2012-09-06 14:59:44 +04:00
parent 7a15a26cf2
commit a06512b331
4 changed files with 36 additions and 0 deletions
@@ -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);
@@ -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;
}
}
}
@@ -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);
}
}