void (PsiCall expression) { PsiExpressionList argumentList = expression.getArgumentList(); if (argumentList == null) return; PsiExpression[] args = argumentList.getExpressions(); if (args.length == 0) return; final JavaResolveResult oldResult = expression.resolveMethodGenerics(); final PsiElement element = oldResult.getElement(); if (!(element instanceof PsiMethod oldMethod)) return; PsiParameter[] parameters = oldMethod.getParameterList().getParameters(); PsiCall newCall = null; for (int i = 0; i < args.length; i++) { final PsiExpression arg = deparenthesizeExpression(args[i]); if (!(arg instanceof PsiTypeCastExpression) && !(arg instanceof PsiLambdaExpression) && !(arg instanceof PsiConditionalExpression)) { continue; } ProgressManager.checkCanceled(); if (newCall == null) { newCall = copyCallExpression(expression, PsiTypesUtil.getExpectedTypeByParent(expression)); } if (newCall == null) return; final PsiExpressionList argList = newCall.getArgumentList(); LOG.assertTrue(argList != null); PsiExpression[] newArgs = argList.getExpressions(); LOG.assertTrue(newArgs.length == args.length, "oldCall: " + expression.getText() + "; old length: " + args.length + "; newCall: " + newCall.getText() + "; new length: " + newArgs.length); if (arg instanceof PsiTypeCastExpression) { checkTypeCastInCallArgument(i, (PsiTypeCastExpression)arg, newArgs, expression, newCall); } else if (arg instanceof PsiLambdaExpression) { checkLambdaReturnsInsideCall(i, (PsiLambdaExpression)arg, newArgs, expression, newCall, parameters); } else { PsiType conditionalType = arg.getType(); PsiExpression thenExpression = deparenthesizeExpression(((PsiConditionalExpression)arg).getThenExpression()); PsiExpression elseExpression = deparenthesizeExpression(((PsiConditionalExpression)arg).getElseExpression()); if (thenExpression instanceof PsiTypeCastExpression && !castForBoxing(getInnerMostOperand(thenExpression), elseExpression != null ? elseExpression.getType() : null, conditionalType)) { PsiExpression newThenExpression = deparenthesizeExpression(((PsiConditionalExpression)Objects.requireNonNull(deparenthesizeExpression(newArgs[i]))).getThenExpression()); checkConditionalBranch(expression, newCall, thenExpression, newThenExpression); } if (elseExpression instanceof PsiTypeCastExpression && !castForBoxing(getInnerMostOperand(elseExpression), thenExpression != null ? thenExpression.getType() : null, conditionalType)) { PsiExpression newElseExpression = deparenthesizeExpression(((PsiConditionalExpression)Objects.requireNonNull(deparenthesizeExpression(newArgs[i]))).getElseExpression()); checkConditionalBranch(expression, newCall, elseExpression, newElseExpression); } } } }