From a1c0c679ee73f75fac679aacfb3ff4d84142c21f Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 19 Oct 2018 00:48:13 +0300 Subject: [PATCH] Common String.toNumber: clarify thrown exception types --- libraries/stdlib/common/src/kotlin/TextH.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/stdlib/common/src/kotlin/TextH.kt b/libraries/stdlib/common/src/kotlin/TextH.kt index e6feb02eb80..3179b4f496c 100644 --- a/libraries/stdlib/common/src/kotlin/TextH.kt +++ b/libraries/stdlib/common/src/kotlin/TextH.kt @@ -221,6 +221,7 @@ expect fun String.toByte(): Byte /** * Parses the string as a signed [Byte] number and returns the result. * @throws NumberFormatException if the string is not a valid representation of a number. + * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion. */ expect fun String.toByte(radix: Int): Byte @@ -234,6 +235,7 @@ expect fun String.toShort(): Short /** * Parses the string as a [Short] number and returns the result. * @throws NumberFormatException if the string is not a valid representation of a number. + * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion. */ expect fun String.toShort(radix: Int): Short @@ -246,6 +248,7 @@ expect fun String.toInt(): Int /** * Parses the string as an [Int] number and returns the result. * @throws NumberFormatException if the string is not a valid representation of a number. + * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion. */ expect fun String.toInt(radix: Int): Int @@ -258,6 +261,7 @@ expect fun String.toLong(): Long /** * Parses the string as a [Long] number and returns the result. * @throws NumberFormatException if the string is not a valid representation of a number. + * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion. */ expect fun String.toLong(radix: Int): Long