void (@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); final PsiReferenceExpression methodExpression = expression.getMethodExpression(); @NonNls final String methodName = methodExpression.getReferenceName(); if (!"toArray".equals(methodName)) { return; } final PsiExpression qualifierExpression = methodExpression.getQualifierExpression(); if (qualifierExpression == null) { return; } final PsiClassType classType = ObjectUtils.tryCast(qualifierExpression.getType(), PsiClassType.class); if (classType == null || classType.isRaw()) return; final PsiExpressionList argumentList = expression.getArgumentList(); final PsiExpression[] arguments = argumentList.getExpressions(); if (arguments.length != 1) { return; } final PsiExpression argument = PsiUtil.skipParenthesizedExprDown(arguments[0]); if (argument == null) return; final PsiClass aClass = classType.resolve(); if (aClass == null) { return; } if (InheritanceUtil.isInheritor(aClass, CommonClassNames.JAVA_UTIL_COLLECTION)) { PsiType itemType = JavaGenericsUtil.getCollectionItemType(classType, expression.getResolveScope()); PsiType argumentType = argument.getType(); if (!(argumentType instanceof PsiArrayType)) { argumentType = getIntFunctionParameterType(argument); } checkArrayTypes(argument, expression, argumentType, itemType); } else if (InheritanceUtil.isInheritor(aClass, CommonClassNames.JAVA_UTIL_STREAM_STREAM)) { PsiType argumentType = getIntFunctionParameterType(argument); if (argumentType != null) { checkArrayTypes(argument, expression, argumentType, getStreamElementType(qualifierExpression)); } } }