[Stdlib] Deprecate and make open Number.toChar()

^KT-46465 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-02-21 12:53:58 +02:00
committed by Space Team
parent 90ec84d7b7
commit a64d8e8a31
30 changed files with 399 additions and 72 deletions
+5 -2
View File
@@ -43,8 +43,11 @@ public abstract class Number {
/**
* Returns the [Char] with the numeric value equal to this number, truncated to 16 bits if appropriate.
*/
// @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
public abstract fun toChar(): Char
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.\nIf you override toChar() function in your Number inheritor, it's recommended to gradually deprecate the overriding function and then remove it.\nSee https://youtrack.jetbrains.com/issue/KT-46465 for details about the migration", ReplaceWith("this.toInt().toChar()"))
@DeprecatedSinceKotlin(warningSince = "1.9", errorSince = "2.3")
public open fun toChar(): Char {
return toInt().toChar()
}
/**
* Returns the value of this number as a [Short], which may involve rounding or truncation.