ReturnValue (LighterASTNode statement, LighterASTNode target) { List<LighterASTNode> branches = getChildrenOfType(tree, statement, ElementType.JAVA_STATEMENT_BIT_SET); LighterASTNode condition = findExpressionChild(tree, statement); LighterASTNode thenBranch = ContainerUtil.getFirstItem(branches); LighterASTNode elseBranch = branches.size() == 2 ? branches.get(1) : null; boolean thenBreaks = completesAbruptly(thenBranch); boolean elseBreaks = completesAbruptly(elseBranch); ReturnValue thenValue = findValueInStatement(thenBranch, target); ReturnValue elseValue = findValueInStatement(elseBranch, target); if (elseValue == null && thenBreaks && !elseBreaks && isNullCheck(condition, target, true)) { elseValue = ReturnValue.NOT_NULL; } if (thenValue == null && elseBreaks && !thenBreaks && isNullCheck(condition, target, false)) { thenValue = ReturnValue.NOT_NULL; } if (thenBreaks && !elseBreaks) { thenValue = elseValue; } if (elseBreaks && !thenBreaks) { elseValue = thenValue; } if (thenValue == null) { thenValue = isNullCheck(condition, target, false) ? ReturnValue.NOT_NULL : findValueInExpression(condition, target); } if (elseValue == null) { elseValue = isNullCheck(condition, target, true) ? ReturnValue.NOT_NULL : findValueInExpression(condition, target); } if (thenValue == null || elseValue == null) { return null; } return ReturnValue.merge(thenValue, elseValue); }