Deprecate String.concat with error severity.

Fix concat j2k conversion.
Add expected deprecation errors for Java String constructors that must be converted to special Kotlin String methods.
This commit is contained in:
Ilya Gorbunov
2016-01-20 15:50:47 +03:00
parent 2257fa36ec
commit 31ec7bcbea
5 changed files with 10 additions and 4 deletions
@@ -1,3 +1,5 @@
// ERROR: Using 'String(ByteArray, String): String' is an error. Use String(bytes, Charset) instead.
// ERROR: Using 'String(ByteArray, Int, Int, String): String' is an error. Use String(bytes, offset, length, Charset) instead.
import java.nio.charset.Charset
import java.util.*
@@ -33,7 +35,6 @@ internal class A {
s.codePointCount(0, s.length)
s.offsetByCodePoints(0, 4)
s.compareTo("test 2")
s.concat(" another")
s.contains("seq")
s.contentEquals(StringBuilder(s))
s.contentEquals(StringBuffer(s))
@@ -81,6 +82,7 @@ internal class A {
val limit = 5
useSplit(s.split("\\s+".toRegex(), limit.coerceAtLeast(0)).toTypedArray())
s.trim { it <= ' ' }
s + " another"
s.toByteArray()
s.toByteArray(Charset.forName("utf-8"))