Minor: reorder invariant arrays of objects in generated code
This commit is contained in:
@@ -11254,6 +11254,15 @@ public fun ShortArray.binarySearch(element: Short, fromIndex: Int = 0, toIndex:
|
||||
return Arrays.binarySearch(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array.
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
@JvmName("mutableCopyOf")
|
||||
public fun <T> Array<T>.copyOf(): Array<T> {
|
||||
return Arrays.copyOf(this, size)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array.
|
||||
*/
|
||||
@@ -11323,8 +11332,8 @@ public fun ShortArray.copyOf(): ShortArray {
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
@JvmName("mutableCopyOf")
|
||||
public fun <T> Array<T>.copyOf(): Array<T> {
|
||||
return Arrays.copyOf(this, size)
|
||||
public fun <T> Array<T>.copyOf(newSize: Int): Array<T?> {
|
||||
return Arrays.copyOf(this, newSize)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11392,12 +11401,12 @@ public fun ShortArray.copyOf(newSize: Int): ShortArray {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of the original array.
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
@JvmName("mutableCopyOf")
|
||||
public fun <T> Array<T>.copyOf(newSize: Int): Array<T?> {
|
||||
return Arrays.copyOf(this, newSize)
|
||||
@JvmName("mutableCopyOfRange")
|
||||
public fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T> {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11465,12 +11474,11 @@ public fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
@JvmName("mutableCopyOfRange")
|
||||
public fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T> {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
public fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
Arrays.fill(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11537,14 +11545,6 @@ public fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = si
|
||||
Arrays.fill(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills original array with the provided value.
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
public fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||
Arrays.fill(this, fromIndex, toIndex, element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements that are instances of specified type parameter R.
|
||||
*/
|
||||
@@ -11579,6 +11579,17 @@ public fun <C : MutableCollection<in R>, R> Array<*>.filterIsInstanceTo(destinat
|
||||
return destination
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing all elements of the original array and then the given [element].
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
public operator fun <T> Array<T>.plus(element: T): Array<T> {
|
||||
val index = size
|
||||
val result = Arrays.copyOf(this, index + 1)
|
||||
result[index] = element
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing all elements of the original array and then the given [element].
|
||||
*/
|
||||
@@ -11668,13 +11679,13 @@ public operator fun ShortArray.plus(element: Short): ShortArray {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing all elements of the original array and then the given [element].
|
||||
* Returns an array containing all elements of the original array and then all elements of the given [elements] collection.
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
public operator fun <T> Array<T>.plus(element: T): Array<T> {
|
||||
val index = size
|
||||
val result = Arrays.copyOf(this, index + 1)
|
||||
result[index] = element
|
||||
public operator fun <T> Array<T>.plus(elements: Collection<T>): Array<T> {
|
||||
var index = size
|
||||
val result = Arrays.copyOf(this, index + elements.size)
|
||||
for (element in elements) result[index++] = element
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -11767,13 +11778,14 @@ public operator fun ShortArray.plus(elements: Collection<Short>): ShortArray {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing all elements of the original array and then all elements of the given [elements] collection.
|
||||
* Returns an array containing all elements of the original array and then all elements of the given [elements] array.
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
public operator fun <T> Array<T>.plus(elements: Collection<T>): Array<T> {
|
||||
var index = size
|
||||
val result = Arrays.copyOf(this, index + elements.size)
|
||||
for (element in elements) result[index++] = element
|
||||
public operator fun <T> Array<T>.plus(elements: Array<out T>): Array<T> {
|
||||
val thisSize = size
|
||||
val arraySize = elements.size
|
||||
val result = Arrays.copyOf(this, thisSize + arraySize)
|
||||
System.arraycopy(elements, 0, result, thisSize, arraySize)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -11873,18 +11885,6 @@ public operator fun ShortArray.plus(elements: ShortArray): ShortArray {
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing all elements of the original array and then all elements of the given [elements] array.
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
public operator fun <T> Array<T>.plus(elements: Array<out T>): Array<T> {
|
||||
val thisSize = size
|
||||
val arraySize = elements.size
|
||||
val result = Arrays.copyOf(this, thisSize + arraySize)
|
||||
System.arraycopy(elements, 0, result, thisSize, arraySize)
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array in-place.
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,9 @@ enum class Family {
|
||||
Lists,
|
||||
Maps,
|
||||
Sets,
|
||||
InvariantArraysOfObjects,
|
||||
ArraysOfObjects,
|
||||
ArraysOfPrimitives,
|
||||
InvariantArraysOfObjects,
|
||||
CharSequences,
|
||||
Strings,
|
||||
Ranges,
|
||||
@@ -175,7 +175,7 @@ class GenericFunction(val signature: String, val keyword: String = "fun") {
|
||||
|
||||
fun instantiate(vararg families: Family = Family.values()): List<ConcreteFunction> {
|
||||
return families
|
||||
.sortedBy { it.name }
|
||||
.sortedBy { if (it == InvariantArraysOfObjects) "ArraysOfObjectsInvariant" else it.name }
|
||||
.filter { buildFamilies.contains(it) }
|
||||
.flatMap { family -> instantiate(family) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user