Document that array constructor throws RuntimeException on negative size

This commit is contained in:
Abduqodiri Qurbonzoda
2023-06-12 02:14:40 +03:00
committed by Space Team
parent 9f16daac02
commit da8f9fbd04
5 changed files with 95 additions and 7 deletions
+3
View File
@@ -35,6 +35,7 @@ class GenerateArrays(out: PrintWriter) : BuiltInsSourceGenerator(out) {
out.println("/**")
out.println(" * An array of ${typeLower}s. When targeting the JVM, instances of this class are represented as `$typeLower[]`.")
out.println(" * @constructor Creates a new array of the specified [size], with all elements initialized to $defaultValue.")
out.println(" * @throws RuntimeException if the specified [size] is negative.")
out.println(" */")
out.println("public class ${s}Array(size: Int) {")
out.println(" /**")
@@ -43,6 +44,8 @@ class GenerateArrays(out: PrintWriter) : BuiltInsSourceGenerator(out) {
out.println(" *")
out.println(" * The function [init] is called for each array element sequentially starting from the first one.")
out.println(" * It should return the value for an array element given its index.")
out.println(" *")
out.println(" * @throws RuntimeException if the specified [size] is negative.")
out.println(" */")
out.println(" public inline constructor(size: Int, init: (Int) -> $s)")
out.println()