java applicability checks: do not calculate type when it won't be used

GitOrigin-RevId: 65e177cf43a5c4d81b888079bb280f38599604a8
This commit is contained in:
Anna.Kozlova
2020-01-08 08:01:20 +00:00
committed by intellij-monorepo-bot
parent 3ae38e0404
commit 3c6b2f5519
@@ -658,9 +658,9 @@ public class LambdaUtil {
}
}
else if (body instanceof PsiExpression) {
final PsiType type = ((PsiExpression)body).getType();
try {
if (!PsiUtil.isStatement(JavaPsiFacade.getElementFactory(body.getProject()).createStatementFromText(body.getText(), body))) {
final PsiType type = ((PsiExpression)body).getType();
if (PsiType.VOID.equals(type)) {
errors.put(body, "Lambda body must be a statement expression");
}