boolean ( PsiStatement statement, PsiMethod method) { if (statement == null) { return true; } if (statement instanceof PsiBreakStatement || statement instanceof PsiContinueStatement || statement instanceof PsiThrowStatement || statement instanceof PsiExpressionListStatement || statement instanceof PsiExpressionStatement || statement instanceof PsiEmptyStatement || statement instanceof PsiAssertStatement || statement instanceof PsiDeclarationStatement) { return false; } else if (statement instanceof PsiReturnStatement returnStatement) { final PsiExpression returnValue = returnStatement.getReturnValue(); if (returnValue != null) { if (expressionDefinitelyRecurses(returnValue, method)) { return false; } } return true; } else if (statement instanceof PsiForStatement) { return forStatementMayReturnBeforeRecursing( (PsiForStatement)statement, method); } else if (statement instanceof PsiForeachStatement) { return foreachStatementMayReturnBeforeRecursing( (PsiForeachStatement)statement, method); } else if (statement instanceof PsiWhileStatement) { return whileStatementMayReturnBeforeRecursing( (PsiWhileStatement)statement, method); } else if (statement instanceof PsiDoWhileStatement) { return doWhileStatementMayReturnBeforeRecursing( (PsiDoWhileStatement)statement, method); } else if (statement instanceof PsiSynchronizedStatement) { final PsiCodeBlock body = ((PsiSynchronizedStatement)statement) .getBody(); return codeBlockMayReturnBeforeRecursing(body, method, false); } else if (statement instanceof PsiBlockStatement blockStatement) { final PsiCodeBlock codeBlock = blockStatement.getCodeBlock(); return codeBlockMayReturnBeforeRecursing(codeBlock, method, false); } else if (statement instanceof PsiLabeledStatement) { return labeledStatementMayReturnBeforeRecursing( (PsiLabeledStatement)statement, method); } else if (statement instanceof PsiIfStatement) { return ifStatementMayReturnBeforeRecursing( (PsiIfStatement)statement, method); } else if (statement instanceof PsiTryStatement) { return tryStatementMayReturnBeforeRecursing( (PsiTryStatement)statement, method); } else if (statement instanceof PsiSwitchStatement) { return switchBlockMayReturnBeforeRecursing( (PsiSwitchStatement)statement, method); } else { // unknown statement type return true; } }