mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
clear error message (IDEA-154419)
This commit is contained in:
@@ -641,6 +641,9 @@ public class LambdaUtil {
|
||||
final PsiType type = ((PsiExpression)body).getType();
|
||||
try {
|
||||
if (!PsiUtil.isStatement(JavaPsiFacade.getElementFactory(body.getProject()).createStatementFromText(body.getText(), body))) {
|
||||
if (PsiType.VOID.equals(type)) {
|
||||
return "Lambda body must be a statement expression";
|
||||
}
|
||||
return "Bad return type in lambda expression: " + (type == PsiType.NULL || type == null ? "<null>" : type.getPresentableText()) + " cannot be converted to void";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class Main {
|
||||
|
||||
I<Integer> i1 = i -> <error descr="Bad return type in lambda expression: int cannot be converted to void">i * 2</error>;
|
||||
I<Integer> i2 = i -> <error descr="Bad return type in lambda expression: int cannot be converted to void">2 * i</error>;
|
||||
I<Integer> i3 = i -> <error descr="Bad return type in lambda expression: void cannot be converted to void">true ? foo() : foo()</error>;
|
||||
I<Integer> i3 = i -> <error descr="Lambda body must be a statement expression">true ? foo() : foo()</error>;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user