diff --git a/core/builtins/native/kotlin/Arrays.kt b/core/builtins/native/kotlin/Arrays.kt index f6d8d28ab8c..bc170a67239 100644 --- a/core/builtins/native/kotlin/Arrays.kt +++ b/core/builtins/native/kotlin/Arrays.kt @@ -32,7 +32,7 @@ public class ByteArray(size: Int) { /** * An array of chars. When targeting the JVM, instances of this class are represented as `char[]`. - * @constructor Creates a new array of the specified [size], with all elements initialized to zero. + * @constructor Creates a new array of the specified [size], with all elements initialized to null char (`\u0000'). */ public class CharArray(size: Int) { /** @@ -170,7 +170,7 @@ public class DoubleArray(size: Int) { /** * An array of booleans. When targeting the JVM, instances of this class are represented as `boolean[]`. - * @constructor Creates a new array of the specified [size], with all elements initialized to false. + * @constructor Creates a new array of the specified [size], with all elements initialized to `false`. */ public class BooleanArray(size: Int) { /** diff --git a/generators/builtins/arrays.kt b/generators/builtins/arrays.kt index f914e305f21..a39cfce35e9 100644 --- a/generators/builtins/arrays.kt +++ b/generators/builtins/arrays.kt @@ -27,7 +27,11 @@ class GenerateArrays(out: PrintWriter) : BuiltInsSourceGenerator(out) { for (kind in PrimitiveType.values()) { val typeLower = kind.name.toLowerCase() val s = kind.capitalized - val defaultValue = if (kind == PrimitiveType.BOOLEAN) "false" else "zero" + val defaultValue = when (kind) { + PrimitiveType.CHAR -> "null char (`\\u0000')" + PrimitiveType.BOOLEAN -> "`false`" + else -> "zero" + } 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.")