diff --git a/libraries/stdlib/common/src/generated/_Arrays.kt b/libraries/stdlib/common/src/generated/_Arrays.kt index 50809a1b32e..f2ec2c3a134 100644 --- a/libraries/stdlib/common/src/generated/_Arrays.kt +++ b/libraries/stdlib/common/src/generated/_Arrays.kt @@ -2761,6 +2761,8 @@ public inline fun CharArray.singleOrNull(predicate: (Char) -> Boolean): Char? { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun Array.drop(n: Int): List { @@ -2771,6 +2773,8 @@ public fun Array.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun ByteArray.drop(n: Int): List { @@ -2781,6 +2785,8 @@ public fun ByteArray.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun ShortArray.drop(n: Int): List { @@ -2791,6 +2797,8 @@ public fun ShortArray.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun IntArray.drop(n: Int): List { @@ -2801,6 +2809,8 @@ public fun IntArray.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun LongArray.drop(n: Int): List { @@ -2811,6 +2821,8 @@ public fun LongArray.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun FloatArray.drop(n: Int): List { @@ -2821,6 +2833,8 @@ public fun FloatArray.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun DoubleArray.drop(n: Int): List { @@ -2831,6 +2845,8 @@ public fun DoubleArray.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun BooleanArray.drop(n: Int): List { @@ -2841,6 +2857,8 @@ public fun BooleanArray.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun CharArray.drop(n: Int): List { @@ -2851,6 +2869,8 @@ public fun CharArray.drop(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun Array.dropLast(n: Int): List { @@ -2861,6 +2881,8 @@ public fun Array.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun ByteArray.dropLast(n: Int): List { @@ -2871,6 +2893,8 @@ public fun ByteArray.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun ShortArray.dropLast(n: Int): List { @@ -2881,6 +2905,8 @@ public fun ShortArray.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun IntArray.dropLast(n: Int): List { @@ -2891,6 +2917,8 @@ public fun IntArray.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun LongArray.dropLast(n: Int): List { @@ -2901,6 +2929,8 @@ public fun LongArray.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun FloatArray.dropLast(n: Int): List { @@ -2911,6 +2941,8 @@ public fun FloatArray.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun DoubleArray.dropLast(n: Int): List { @@ -2921,6 +2953,8 @@ public fun DoubleArray.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun BooleanArray.dropLast(n: Int): List { @@ -2931,6 +2965,8 @@ public fun BooleanArray.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun CharArray.dropLast(n: Int): List { @@ -4087,6 +4123,8 @@ public fun CharArray.sliceArray(indices: IntRange): CharArray { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun Array.take(n: Int): List { @@ -4107,6 +4145,8 @@ public fun Array.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun ByteArray.take(n: Int): List { @@ -4127,6 +4167,8 @@ public fun ByteArray.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun ShortArray.take(n: Int): List { @@ -4147,6 +4189,8 @@ public fun ShortArray.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun IntArray.take(n: Int): List { @@ -4167,6 +4211,8 @@ public fun IntArray.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun LongArray.take(n: Int): List { @@ -4187,6 +4233,8 @@ public fun LongArray.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun FloatArray.take(n: Int): List { @@ -4207,6 +4255,8 @@ public fun FloatArray.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun DoubleArray.take(n: Int): List { @@ -4227,6 +4277,8 @@ public fun DoubleArray.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun BooleanArray.take(n: Int): List { @@ -4247,6 +4299,8 @@ public fun BooleanArray.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun CharArray.take(n: Int): List { @@ -4267,6 +4321,8 @@ public fun CharArray.take(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun Array.takeLast(n: Int): List { @@ -4284,6 +4340,8 @@ public fun Array.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun ByteArray.takeLast(n: Int): List { @@ -4301,6 +4359,8 @@ public fun ByteArray.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun ShortArray.takeLast(n: Int): List { @@ -4318,6 +4378,8 @@ public fun ShortArray.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun IntArray.takeLast(n: Int): List { @@ -4335,6 +4397,8 @@ public fun IntArray.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun LongArray.takeLast(n: Int): List { @@ -4352,6 +4416,8 @@ public fun LongArray.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun FloatArray.takeLast(n: Int): List { @@ -4369,6 +4435,8 @@ public fun FloatArray.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun DoubleArray.takeLast(n: Int): List { @@ -4386,6 +4454,8 @@ public fun DoubleArray.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun BooleanArray.takeLast(n: Int): List { @@ -4403,6 +4473,8 @@ public fun BooleanArray.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun CharArray.takeLast(n: Int): List { diff --git a/libraries/stdlib/common/src/generated/_Collections.kt b/libraries/stdlib/common/src/generated/_Collections.kt index 1c045d13076..f35965dc90f 100644 --- a/libraries/stdlib/common/src/generated/_Collections.kt +++ b/libraries/stdlib/common/src/generated/_Collections.kt @@ -581,6 +581,8 @@ public inline fun Iterable.singleOrNull(predicate: (T) -> Boolean): T? { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun Iterable.drop(n: Int): List { @@ -618,6 +620,8 @@ public fun Iterable.drop(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun List.dropLast(n: Int): List { @@ -765,6 +769,8 @@ public fun List.slice(indices: Iterable): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun Iterable.take(n: Int): List { @@ -787,6 +793,8 @@ public fun Iterable.take(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun List.takeLast(n: Int): List { diff --git a/libraries/stdlib/common/src/generated/_Sequences.kt b/libraries/stdlib/common/src/generated/_Sequences.kt index a22b5f70cdd..5e630f59d5b 100644 --- a/libraries/stdlib/common/src/generated/_Sequences.kt +++ b/libraries/stdlib/common/src/generated/_Sequences.kt @@ -347,6 +347,8 @@ public inline fun Sequence.singleOrNull(predicate: (T) -> Boolean): T? { * * The operation is _intermediate_ and _stateless_. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ public fun Sequence.drop(n: Int): Sequence { @@ -478,6 +480,8 @@ public inline fun > Sequence.filterTo(destinat * * The operation is _intermediate_ and _stateless_. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ public fun Sequence.take(n: Int): Sequence { diff --git a/libraries/stdlib/common/src/generated/_Strings.kt b/libraries/stdlib/common/src/generated/_Strings.kt index e3ef46f5fa8..ff4dd113b6d 100644 --- a/libraries/stdlib/common/src/generated/_Strings.kt +++ b/libraries/stdlib/common/src/generated/_Strings.kt @@ -250,6 +250,8 @@ public inline fun CharSequence.singleOrNull(predicate: (Char) -> Boolean): Char? /** * Returns a subsequence of this char sequence with the first [n] characters removed. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.text.Strings.drop */ public fun CharSequence.drop(n: Int): CharSequence { @@ -260,6 +262,8 @@ public fun CharSequence.drop(n: Int): CharSequence { /** * Returns a string with the first [n] characters removed. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.text.Strings.drop */ public fun String.drop(n: Int): String { @@ -270,6 +274,8 @@ public fun String.drop(n: Int): String { /** * Returns a subsequence of this char sequence with the last [n] characters removed. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.text.Strings.drop */ public fun CharSequence.dropLast(n: Int): CharSequence { @@ -280,6 +286,8 @@ public fun CharSequence.dropLast(n: Int): CharSequence { /** * Returns a string with the last [n] characters removed. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.text.Strings.drop */ public fun String.dropLast(n: Int): String { @@ -452,6 +460,8 @@ public inline fun String.slice(indices: Iterable): String { /** * Returns a subsequence of this char sequence containing the first [n] characters from this char sequence, or the entire char sequence if this char sequence is shorter. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.text.Strings.take */ public fun CharSequence.take(n: Int): CharSequence { @@ -462,6 +472,8 @@ public fun CharSequence.take(n: Int): CharSequence { /** * Returns a string containing the first [n] characters from this string, or the entire string if this string is shorter. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.text.Strings.take */ public fun String.take(n: Int): String { @@ -472,6 +484,8 @@ public fun String.take(n: Int): String { /** * Returns a subsequence of this char sequence containing the last [n] characters from this char sequence, or the entire char sequence if this char sequence is shorter. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.text.Strings.take */ public fun CharSequence.takeLast(n: Int): CharSequence { @@ -483,6 +497,8 @@ public fun CharSequence.takeLast(n: Int): CharSequence { /** * Returns a string containing the last [n] characters from this string, or the entire string if this string is shorter. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.text.Strings.take */ public fun String.takeLast(n: Int): String { diff --git a/libraries/stdlib/common/src/generated/_UArrays.kt b/libraries/stdlib/common/src/generated/_UArrays.kt index b869a93f94e..50c273ac525 100644 --- a/libraries/stdlib/common/src/generated/_UArrays.kt +++ b/libraries/stdlib/common/src/generated/_UArrays.kt @@ -1375,6 +1375,8 @@ public inline fun UShortArray.singleOrNull(predicate: (UShort) -> Boolean): USho /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ @SinceKotlin("1.3") @@ -1387,6 +1389,8 @@ public fun UIntArray.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ @SinceKotlin("1.3") @@ -1399,6 +1403,8 @@ public fun ULongArray.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ @SinceKotlin("1.3") @@ -1411,6 +1417,8 @@ public fun UByteArray.drop(n: Int): List { /** * Returns a list containing all elements except first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ @SinceKotlin("1.3") @@ -1423,6 +1431,8 @@ public fun UShortArray.drop(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ @SinceKotlin("1.3") @@ -1435,6 +1445,8 @@ public fun UIntArray.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ @SinceKotlin("1.3") @@ -1447,6 +1459,8 @@ public fun ULongArray.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ @SinceKotlin("1.3") @@ -1459,6 +1473,8 @@ public fun UByteArray.dropLast(n: Int): List { /** * Returns a list containing all elements except last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.drop */ @SinceKotlin("1.3") @@ -2071,6 +2087,8 @@ public fun UShortArray.sliceArray(indices: IntRange): UShortArray { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ @SinceKotlin("1.3") @@ -2093,6 +2111,8 @@ public fun UIntArray.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ @SinceKotlin("1.3") @@ -2115,6 +2135,8 @@ public fun ULongArray.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ @SinceKotlin("1.3") @@ -2137,6 +2159,8 @@ public fun UByteArray.take(n: Int): List { /** * Returns a list containing first [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ @SinceKotlin("1.3") @@ -2159,6 +2183,8 @@ public fun UShortArray.take(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ @SinceKotlin("1.3") @@ -2178,6 +2204,8 @@ public fun UIntArray.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ @SinceKotlin("1.3") @@ -2197,6 +2225,8 @@ public fun ULongArray.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ @SinceKotlin("1.3") @@ -2216,6 +2246,8 @@ public fun UByteArray.takeLast(n: Int): List { /** * Returns a list containing last [n] elements. * + * @throws IllegalArgumentException if [n] is negative. + * * @sample samples.collections.Collections.Transformations.take */ @SinceKotlin("1.3") diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt index bd824707c60..3760fab5f43 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt @@ -52,6 +52,7 @@ object Filtering : TemplateGroupBase() { Returns a list containing all elements except first [n] elements. """ } + throws("IllegalArgumentException", "if [n] is negative.") sample("${sampleClass(f)}.drop") returns("List") body { @@ -138,6 +139,7 @@ object Filtering : TemplateGroupBase() { Returns a list containing first [n] elements. """ } + throws("IllegalArgumentException", "if [n] is negative.") sample("${sampleClass(f)}.take") returns("List") body { @@ -218,6 +220,7 @@ object Filtering : TemplateGroupBase() { Returns a list containing all elements except last [n] elements. """ } + throws("IllegalArgumentException", "if [n] is negative.") sample("${sampleClass(f)}.drop") returns("List") body { @@ -247,6 +250,7 @@ object Filtering : TemplateGroupBase() { Returns a list containing last [n] elements. """ } + throws("IllegalArgumentException", "if [n] is negative.") sample("${sampleClass(f)}.take") returns("List") specialFor(Strings, CharSequences) { diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/CommonTypes.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/CommonTypes.kt index 1b60b46199a..a4820e78ca1 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/CommonTypes.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/CommonTypes.kt @@ -137,4 +137,6 @@ enum class SequenceClass { } data class Deprecation(val message: String, val replaceWith: String? = null, val level: DeprecationLevel = DeprecationLevel.WARNING) -val forBinaryCompatibility = Deprecation("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) \ No newline at end of file +val forBinaryCompatibility = Deprecation("Provided for binary compatibility", level = DeprecationLevel.HIDDEN) + +data class ThrowsException(val exceptionType: String, val reason: String) \ No newline at end of file diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/MemberBuilder.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/MemberBuilder.kt index b6ef58efeed..0a1f67abf70 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/MemberBuilder.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/MemberBuilder.kt @@ -64,6 +64,7 @@ class MemberBuilder( var toNullableT: Boolean = false var returns: String? = null; private set + val throwsExceptions = mutableListOf() var body: String? = null; private set val annotations: MutableList = mutableListOf() val suppressions: MutableList = mutableListOf() @@ -99,6 +100,8 @@ class MemberBuilder( @Deprecated("Use specialFor", ReplaceWith("specialFor(*fs) { returns(run(valueBuilder)) }")) fun returns(vararg fs: Family, valueBuilder: () -> String) = specialFor(*fs) { returns(run(valueBuilder)) } + fun throws(exceptionType: String, reason: String) { throwsExceptions += ThrowsException(exceptionType, reason) } + fun typeParam(typeParameterName: String, primary: Boolean = false) { typeParams += typeParameterName if (primary) { @@ -300,9 +303,13 @@ class MemberBuilder( builder.append(" *\n") builder.append(" * The operation is ${sequenceClassification.joinToString(" and ") { "_${it}_" }}.\n") } + if (throwsExceptions.any()) { + builder.append(" * \n") + throwsExceptions.forEach { (type, reason) -> builder.append(" * @throws $type $reason\n") } + } if (samples.any()) { builder.append(" * \n") - samples.forEach { builder.append(" * @sample $it\n")} + samples.forEach { builder.append(" * @sample $it\n") } } builder.append(" */\n") }