Deprecate Char-to-Number conversions in stdlib (JVM and JS)

- Int.toChar was left non-deprecated because the replacement is not intrinsic yet.
- Number.toChar was left non-deprecated because otherwise the deprecation propagates to the override, Int.toChar.

KT-23451
This commit is contained in:
Ilya Gorbunov
2021-04-06 15:36:44 +03:00
parent b976cd812a
commit b64b96eee6
59 changed files with 273 additions and 169 deletions
+11 -11
View File
@@ -102,7 +102,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte>, java.io
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
@@ -144,13 +144,13 @@ public final class Char : kotlin.Comparable<kotlin.Char>, java.io.Serializable {
public final operator fun minus(/*0*/ other: kotlin.Int): kotlin.Char
public final operator fun plus(/*0*/ other: kotlin.Int): kotlin.Char
public final operator fun rangeTo(/*0*/ other: kotlin.Char): kotlin.ranges.CharRange
public final fun toByte(): kotlin.Byte
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toByte(): kotlin.Byte
public final fun toChar(): kotlin.Char
public final fun toDouble(): kotlin.Double
public final fun toFloat(): kotlin.Float
public final fun toInt(): kotlin.Int
public final fun toLong(): kotlin.Long
public final fun toShort(): kotlin.Short
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toDouble()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toDouble(): kotlin.Double
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toFloat()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toFloat(): kotlin.Float
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toInt(): kotlin.Int
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toLong()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toLong(): kotlin.Long
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toShort(): kotlin.Short
public companion object Companion {
/*primary*/ private constructor Companion()
@@ -288,7 +288,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double>, jav
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
@@ -392,7 +392,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float>, java.
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
@@ -569,7 +569,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long>, java.io
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Long
public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int
@@ -682,7 +682,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short>, java.
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
public open override /*1*/ fun toByte(): kotlin.Byte
public open override /*1*/ fun toChar(): kotlin.Char
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
public open override /*1*/ fun toDouble(): kotlin.Double
public open override /*1*/ fun toFloat(): kotlin.Float
public open override /*1*/ fun toInt(): kotlin.Int