From 757dd67b98dd8425dda4f5eeaabf2fab4e99d2e1 Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Fri, 17 Jan 2020 21:16:08 +0300 Subject: [PATCH] Deprecate floating point to integral types lesser than Int #KT-30360 (cherry picked from commit 1df1be0ad950873051598a70c3309520457e1ccd) --- runtime/src/main/kotlin/kotlin/Primitives.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/src/main/kotlin/kotlin/Primitives.kt b/runtime/src/main/kotlin/kotlin/Primitives.kt index 9fd019ac754..0b29897deee 100644 --- a/runtime/src/main/kotlin/kotlin/Primitives.kt +++ b/runtime/src/main/kotlin/kotlin/Primitives.kt @@ -1333,6 +1333,7 @@ public final class Float private constructor() : Number(), Comparable { * * The resulting `Byte` value is equal to `this.toInt().toByte()`. */ + @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) public override fun toByte(): Byte = this.toInt().toByte() /** @@ -1347,6 +1348,7 @@ public final class Float private constructor() : Number(), Comparable { * * The resulting `Short` value is equal to `this.toInt().toShort()`. */ + @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) public override fun toShort(): Short = this.toInt().toShort() /** @@ -1592,6 +1594,7 @@ public final class Double private constructor() : Number(), Comparable { * * The resulting `Byte` value is equal to `this.toInt().toByte()`. */ + @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) public override fun toByte(): Byte = this.toInt().toByte() /** @@ -1606,6 +1609,7 @@ public final class Double private constructor() : Number(), Comparable { * * The resulting `Short` value is equal to `this.toInt().toShort()`. */ + @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) public override fun toShort(): Short = this.toInt().toShort() /**