void (@NotNull PsiConditionalExpression expression) { super.visitConditionalExpression(expression); ConditionalModel model = ConditionalModel.from(expression); if (model == null) return; ConditionalExpressionGenerator generator = ConditionalExpressionGenerator.from(model); if (generator == null || generator.getTokenType().equals("?:")) return; if (PsiTypes.booleanType().equals(model.getType()) && ExpressionUtils.nonStructuralChildren(expression).anyMatch(ExpressionUtils::isNullLiteral)) { // Something like Boolean res = cond1 ? true : cond2 ? false : null // While warning is technically correct, it masks more serious "possible NPE" problem // and the applied fix makes it more confusing return; } PsiExpression replacement = generator.getReplacement(); if (replacement != null) { PsiElement parent = expression.getParent(); if (parent instanceof PsiLambdaExpression && !LambdaUtil.isSafeLambdaBodyReplacement((PsiLambdaExpression)parent, () -> replacement)) { return; } } registerError(expression.getCondition(), generator.generate(new CommentTracker()), expression.getText()); }