ReturnValue (LighterASTNode expr, LighterASTNode target) { LighterASTNode parent; while (true) { parent = tree.getParent(expr); if (parent == null) { return ReturnValue.UNKNOWN; } IElementType type = parent.getTokenType(); if (!ElementType.EXPRESSION_BIT_SET.contains(type)) break; if (type == CONDITIONAL_EXPRESSION) { List<LighterASTNode> operands = getExpressionChildren(tree, parent); if (operands.size() == 3) { LighterASTNode condition = operands.get(0); if (expr.equals(operands.get(1)) && isNullCheck(condition, target, false) || expr.equals(operands.get(2)) && isNullCheck(condition, target, true)) { return ReturnValue.NOT_NULL; } } } expr = parent; } if (ElementType.JAVA_STATEMENT_BIT_SET.contains(parent.getTokenType())) { ReturnValue value = findValueBeforeStatement(parent, target); if (!myParameters.isEmpty()) { // For now disable NULLABLE inference (except delegation case), because contract inference // is not so smart one and we may infer NULLABLE where contract is possible producing noise // nullability warnings value = value.dropNullable(); } return value; } return ReturnValue.UNKNOWN; }