Docs: clarify default element value of CharArray and BooleanArray

This commit is contained in:
Ilya Gorbunov
2018-05-25 20:53:13 +03:00
parent 418db53ba4
commit 3245148206
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -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) {
/**
+5 -1
View File
@@ -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.")