Skip to content

Commit 7a6cddf

Browse files
author
Abduqodiri Qurbonzoda
committed
[K/N] Advance String(CharArray) deprecation level to ERROR
1 parent d28d0a6 commit 7a6cddf

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

kotlin-native/backend.native/tests/harmony_regex/AllCodePointsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AllCodePointsTest {
2727

2828
fun codePointToString(codePoint: Int): String {
2929
val charArray = Char.toChars(codePoint)
30-
return String(charArray, 0, charArray.size)
30+
return charArray.concatToString(0, charArray.size)
3131
}
3232

3333
// TODO: Here is a performance problem: an execution of this test requires much more time than it in Kotlin/JVM.

kotlin-native/backend.native/tests/runtime/basic/hash0.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ import kotlin.test.*
2222
a[2] = 'l'
2323
a[3] = 'l'
2424
a[4] = 'o'
25-
println("Hello".hashCode() == String(a, 0, 5).hashCode())
25+
println("Hello".hashCode() == a.concatToString(0, 5).hashCode())
2626
}

kotlin-native/backend.native/tests/runtime/basic/tostring2.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ import kotlin.test.*
1515
print(" ")
1616
}
1717
println()
18-
println(String(array, 0, array.size))
18+
println(array.concatToString(0, array.size))
1919
}

kotlin-native/runtime/src/main/kotlin/kotlin/text/Strings.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ public actual fun CharSequence.repeat(n: Int): String {
291291
* Converts the characters in the specified array to a string.
292292
*/
293293
@Deprecated("Use CharArray.concatToString() instead", ReplaceWith("chars.concatToString()"))
294+
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
294295
public actual fun String(chars: CharArray): String = chars.concatToString()
295296

296297
/**
@@ -300,6 +301,7 @@ public actual fun String(chars: CharArray): String = chars.concatToString()
300301
* or `offset + length` is out of [chars] array bounds.
301302
*/
302303
@Deprecated("Use CharArray.concatToString(startIndex, endIndex) instead", ReplaceWith("chars.concatToString(offset, offset + length)"))
304+
@DeprecatedSinceKotlin(warningSince = "1.4", errorSince = "1.5")
303305
public actual fun String(chars: CharArray, offset: Int, length: Int): String {
304306
if (offset < 0 || length < 0 || offset + length > chars.size)
305307
throw ArrayIndexOutOfBoundsException()

0 commit comments

Comments
 (0)