From e81859b50df0f8c33d1711d797bfcc36b459d6e3 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 16 Nov 2018 19:52:51 +0300 Subject: [PATCH] Document exceptions that can be thrown from MatchGroupCollection.get(name) --- libraries/stdlib/jdk8/src/kotlin/text/RegexExtensions.kt | 3 ++- libraries/stdlib/src/kotlin/text/regex/MatchResult.kt | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/stdlib/jdk8/src/kotlin/text/RegexExtensions.kt b/libraries/stdlib/jdk8/src/kotlin/text/RegexExtensions.kt index 133bbf7e08c..62c51fd875a 100644 --- a/libraries/stdlib/jdk8/src/kotlin/text/RegexExtensions.kt +++ b/libraries/stdlib/jdk8/src/kotlin/text/RegexExtensions.kt @@ -23,7 +23,8 @@ package kotlin.text * Returns a named group with the specified [name]. * * @return An instance of [MatchGroup] if the group with the specified [name] was matched or `null` otherwise. - * @throws [UnsupportedOperationException] if getting named groups isn't supported on the current platform. + * @throws IllegalArgumentException if there is no group with the specified [name] defined in the regex pattern. + * @throws UnsupportedOperationException if getting named groups isn't supported on the current platform. */ @SinceKotlin("1.2") public operator fun MatchGroupCollection.get(name: String): MatchGroup? { diff --git a/libraries/stdlib/src/kotlin/text/regex/MatchResult.kt b/libraries/stdlib/src/kotlin/text/regex/MatchResult.kt index 2ff24dbed2a..c0e11f0b7c9 100644 --- a/libraries/stdlib/src/kotlin/text/regex/MatchResult.kt +++ b/libraries/stdlib/src/kotlin/text/regex/MatchResult.kt @@ -35,6 +35,8 @@ public interface MatchNamedGroupCollection : MatchGroupCollection { /** * Returns a named group with the specified [name]. * @return An instance of [MatchGroup] if the group with the specified [name] was matched or `null` otherwise. + * @throws IllegalArgumentException if there is no group with the specified [name] defined in the regex pattern. + * @throws UnsupportedOperationException if getting named groups isn't supported on the current platform. */ public operator fun get(name: String): MatchGroup? }