void (@NotNull PsiConditionalExpression expression) { super.visitConditionalExpression(expression); if (!myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8) || !PsiPolyExpressionUtil.isPolyExpression(expression)) return; PsiExpression thenExpression = expression.getThenExpression(); PsiExpression elseExpression = expression.getElseExpression(); if (thenExpression == null || elseExpression == null) return; PsiType conditionalType = expression.getType(); if (conditionalType == null) return; PsiExpression[] sides = {thenExpression, elseExpression}; PsiType expectedType = null; boolean isExpectedTypeComputed = false; for (int i = 0; i < sides.length; i++) { PsiExpression side = sides[i]; PsiExpression otherSide = i == 0 ? sides[1] : sides[0]; PsiType sideType = side.getType(); if (sideType != null && !TypeConversionUtil.isAssignable(conditionalType, sideType)) { HighlightInfo.Builder info = HighlightUtil.checkAssignability(conditionalType, sideType, side, side); if (info == null) continue; if (!TypeConversionUtil.isVoidType(sideType)) { if (TypeConversionUtil.isVoidType(otherSide.getType())) { HighlightUtil.registerChangeTypeFix(info, expression, sideType); } else { if (!isExpectedTypeComputed) { PsiElementFactory factory = PsiElementFactory.getInstance(expression.getProject()); PsiExpression expressionCopy = factory.createExpressionFromText(expression.getText(), expression); expectedType = expressionCopy.getType(); isExpectedTypeComputed = true; } if (expectedType != null) { HighlightUtil.registerChangeTypeFix(info, expression, expectedType); } } } add(info); } } }