boolean (String exprText) { final PsiCodeBlock block = myElementFactory.createCodeBlockFromText("{}", myElements[0]); for (PsiElement element : myElements) { block.add(element); } PsiReturnStatement statementFromText = (PsiReturnStatement)myElementFactory.createStatementFromText("return " + exprText + ";", null); statementFromText = (PsiReturnStatement)block.add(statementFromText); return inferNullability(block, Objects.requireNonNull(statementFromText.getReturnValue())) == Nullability.NOT_NULL; }