From d3d239bc1b437658de8c9013155c9e4d4c100387 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 20 Oct 2015 17:29:13 +0300 Subject: [PATCH] Add deprecated xxxValue() extensions to Number for migration. --- libraries/stdlib/src/kotlin/util/Numbers.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libraries/stdlib/src/kotlin/util/Numbers.kt b/libraries/stdlib/src/kotlin/util/Numbers.kt index 133a6c891c2..5e05689d42e 100644 --- a/libraries/stdlib/src/kotlin/util/Numbers.kt +++ b/libraries/stdlib/src/kotlin/util/Numbers.kt @@ -34,3 +34,21 @@ public fun Double.isFinite(): Boolean = !isInfinite() && !isNaN() */ public fun Float.isFinite(): Boolean = !isInfinite() && !isNaN() + +@Deprecated("Use toInt() instead.", ReplaceWith("toInt()")) +public fun Number.intValue(): Int = toInt() + +@Deprecated("Use toLong() instead.", ReplaceWith("toLong()")) +public fun Number.longValue(): Long = toLong() + +@Deprecated("Use toShort() instead.", ReplaceWith("toShort()")) +public fun Number.shortValue(): Short = toShort() + +@Deprecated("Use toByte() instead.", ReplaceWith("toByte()")) +public fun Number.byteValue(): Byte = toByte() + +@Deprecated("Use toDouble() instead.", ReplaceWith("toDouble()")) +public fun Number.doubleValue(): Double = toDouble() + +@Deprecated("Use toFloat() instead.", ReplaceWith("toFloat()")) +public fun Number.floatValue(): Float = toFloat()