Avoid hitting max argument limit in String(chars)

Rewrite CharArray to String conversions to appending chars one by one.

Refine parameter checking in String(chars, offset, length) to adhere to
the common exception contract and document it.

#KT-29003
This commit is contained in:
Ilya Gorbunov
2018-12-29 05:25:19 +03:00
parent b878626919
commit 30c769c19a
4 changed files with 42 additions and 4 deletions
@@ -100,6 +100,9 @@ public expect fun String(chars: CharArray): String
/**
* Converts the characters from a portion of the specified array to a string.
*
* @throws IndexOutOfBoundsException if either [offset] or [length] are less than zero
* or `offset + length` is out of [chars] array bounds.
*/
@SinceKotlin("1.2")
public expect fun String(chars: CharArray, offset: Int, length: Int): String