boolean () { final PsiElement body = getBody(); if (body instanceof PsiCodeBlock) { try { ControlFlow controlFlow = ControlFlowFactory.getControlFlow(body, ourPolicy, ControlFlowOptions.NO_CONST_EVALUATE); int startOffset = controlFlow.getStartOffset(body); int endOffset = controlFlow.getEndOffset(body); if (startOffset != -1 && endOffset != -1 && ControlFlowUtil.canCompleteNormally(controlFlow, startOffset, endOffset)) { return false; } } //error would be shown inside body catch (AnalysisCanceledException ignore) {} for (PsiReturnStatement statement : PsiUtil.findReturnStatements((PsiCodeBlock)body)) { if (statement.getReturnValue() == null) { return false; } } } return true; }