PsiExpression (final PsiElement element, final PsiMethod psiMethod) { final PsiParameter[] psiParameters = psiMethod.getParameterList().getParameters(); final PsiExpressionList argumentList = myMethodCall.getArgumentList(); int idx = 0; for (PsiExpression expression : argumentList.getExpressions()) { if (element != null && PsiTreeUtil.isAncestor(expression, element, false)) { if (psiParameters.length > idx) { final PsiType paramType = psiParameters[idx].getType(); if (paramType instanceof PsiArrayType && !(paramType instanceof PsiEllipsisType)) { final PsiType expressionType = TypeConversionUtil.erasure(expression.getType()); if (expressionType != null && PsiTypesUtil.isDenotableType(expressionType, element) && expressionType != PsiTypes.nullType() && expressionType.getArrayDimensions() < paramType.getArrayDimensions()) { final PsiType componentType = ((PsiArrayType)paramType).getComponentType(); if (TypeConversionUtil.isAssignable(componentType, expressionType)) { boxing = !(componentType instanceof PsiPrimitiveType) && expressionType instanceof PsiPrimitiveType; return expression; } final PsiClass psiClass = PsiUtil.resolveClassInType(componentType); if (ArrayUtilRt.find(psiMethod.getTypeParameters(), psiClass) != -1) { for (PsiClassType superType : psiClass.getSuperTypes()) { if (TypeConversionUtil.isAssignable(superType, expressionType)) { boxing = !(componentType instanceof PsiPrimitiveType) && expressionType instanceof PsiPrimitiveType; return expression; } } } } } } } idx++; } return null; }