boolean (@Nullable PsiElement lambdaCandidate, @NotNull Predicate<? super PsiVariable> variableAllowedPredicate) { if(!(lambdaCandidate instanceof PsiExpression) && !(lambdaCandidate instanceof PsiStatement)) return false; if(!ExceptionUtil.getThrownCheckedExceptions(lambdaCandidate).isEmpty()) return false; CanBeLambdaBodyVisitor visitor = new CanBeLambdaBodyVisitor(lambdaCandidate, variableAllowedPredicate); lambdaCandidate.accept(visitor); return visitor.canBeLambdaBody(); }