Stdlib warnings fixes
This commit is contained in:
committed by
Pavel Punegov
parent
3e153e5937
commit
dee467457b
@@ -122,7 +122,7 @@ fun runProcess(executor: (Action<in ExecSpec>) -> ExecResult?,
|
|||||||
val stdOut = outStream.toString("UTF-8")
|
val stdOut = outStream.toString("UTF-8")
|
||||||
val stdErr = errStream.toString("UTF-8")
|
val stdErr = errStream.toString("UTF-8")
|
||||||
|
|
||||||
return ProcessOutput(stdOut, stdErr, execResult!!.exitValue)
|
return ProcessOutput(stdOut, stdErr, execResult.exitValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun runProcess(executor: (Action<in ExecSpec>) -> ExecResult?,
|
fun runProcess(executor: (Action<in ExecSpec>) -> ExecResult?,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import kotlin.util.sortArray
|
|||||||
/** Returns the array if it's not `null`, or an empty array otherwise. */
|
/** Returns the array if it's not `null`, or an empty array otherwise. */
|
||||||
public actual inline fun <reified T> Array<out T>?.orEmpty(): Array<out T> = this ?: emptyArray<T>()
|
public actual inline fun <reified T> Array<out T>?.orEmpty(): Array<out T> = this ?: emptyArray<T>()
|
||||||
|
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
@PublishedApi internal inline fun checkCopyOfRangeArguments(fromIndex: Int, toIndex: Int, size: Int) {
|
@PublishedApi internal inline fun checkCopyOfRangeArguments(fromIndex: Int, toIndex: Int, size: Int) {
|
||||||
if (toIndex > size)
|
if (toIndex > size)
|
||||||
throw IndexOutOfBoundsException("toIndex ($toIndex) is greater than size ($size).")
|
throw IndexOutOfBoundsException("toIndex ($toIndex) is greater than size ($size).")
|
||||||
@@ -92,9 +92,8 @@ internal fun <T> Array<out T>.contentDeepHashCodeImpl(): Int {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
internal actual fun <T> arrayOfNulls(reference: Array<T>, size: Int): Array<T> {
|
@Suppress("UNCHECKED_CAST")
|
||||||
return (@Suppress("UNCHECKED_CAST")(arrayOfNulls<Any>(size)) as Array<T>)
|
internal actual fun <T> arrayOfNulls(reference: Array<T>, size: Int): Array<T> = arrayOfNulls<Any>(size) as Array<T>
|
||||||
}
|
|
||||||
|
|
||||||
internal actual fun copyToArrayImpl(collection: Collection<*>): Array<Any?> {
|
internal actual fun copyToArrayImpl(collection: Collection<*>): Array<Any?> {
|
||||||
val array = arrayOfUninitializedElements<Any?>(collection.size)
|
val array = arrayOfUninitializedElements<Any?>(collection.size)
|
||||||
@@ -105,6 +104,7 @@ internal actual fun copyToArrayImpl(collection: Collection<*>): Array<Any?> {
|
|||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
internal actual fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<T>): Array<T> {
|
internal actual fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<T>): Array<T> {
|
||||||
if (array.size < collection.size)
|
if (array.size < collection.size)
|
||||||
return copyToArrayImpl(collection) as Array<T>
|
return copyToArrayImpl(collection) as Array<T>
|
||||||
@@ -115,7 +115,7 @@ internal actual fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<
|
|||||||
array[index++] = iterator.next() as T
|
array[index++] = iterator.next() as T
|
||||||
}
|
}
|
||||||
if (index < array.size) {
|
if (index < array.size) {
|
||||||
return (@Suppress("UNCHECKED_CAST")(array as Array<T>)).copyOf(index) as Array<T>
|
return array.copyOf(index) as Array<T>
|
||||||
}
|
}
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,9 @@ import kotlin.random.*
|
|||||||
|
|
||||||
/** Copies typed varargs array to an array of objects */
|
/** Copies typed varargs array to an array of objects */
|
||||||
internal actual fun <T> Array<out T>.copyToArrayOfAny(isVarargs: Boolean): Array<out Any?> =
|
internal actual fun <T> Array<out T>.copyToArrayOfAny(isVarargs: Boolean): Array<out Any?> =
|
||||||
if (isVarargs)
|
// if the array came from varargs and already is array of Any, copying isn't required.
|
||||||
// if the array came from varargs and already is array of Any, copying isn't required.
|
if (isVarargs) this
|
||||||
@Suppress("UNCHECKED_CAST") (this as Array<out Any?>)
|
else this.copyOfUninitializedElements(this.size)
|
||||||
else
|
|
||||||
@Suppress("UNCHECKED_CAST") (this.copyOfUninitializedElements(this.size) as Array<out Any?>)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
package kotlin.collections
|
package kotlin.collections
|
||||||
|
|
||||||
// creates a singleton copy of map, if there is specialization available in target platform, otherwise returns itself
|
// creates a singleton copy of map, if there is specialization available in target platform, otherwise returns itself
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
internal inline actual fun <K, V> Map<K, V>.toSingletonMapOrSelf(): Map<K, V> = toSingletonMap()
|
internal inline actual fun <K, V> Map<K, V>.toSingletonMapOrSelf(): Map<K, V> = toSingletonMap()
|
||||||
|
|
||||||
// creates a singleton copy of map
|
// creates a singleton copy of map
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ internal fun <T> probeCoroutineCreated(completion: Continuation<T>): Continuatio
|
|||||||
* [BaseContinuationImpl] class, despite the fact that the declared type of [frame]
|
* [BaseContinuationImpl] class, despite the fact that the declared type of [frame]
|
||||||
* parameter in this function is `Continuation<*>`. See [probeCoroutineCreated] for details.
|
* parameter in this function is `Continuation<*>`. See [probeCoroutineCreated] for details.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@SinceKotlin("1.3")
|
@SinceKotlin("1.3")
|
||||||
internal fun probeCoroutineResumed(frame: Continuation<*>) {
|
internal fun probeCoroutineResumed(frame: Continuation<*>) {
|
||||||
}
|
}
|
||||||
@@ -68,6 +69,7 @@ internal fun probeCoroutineResumed(frame: Continuation<*>) {
|
|||||||
* [BaseContinuationImpl] class, despite the fact that the declared type of [frame]
|
* [BaseContinuationImpl] class, despite the fact that the declared type of [frame]
|
||||||
* parameter in this function is `Continuation<*>`. See [probeCoroutineCreated] for details.
|
* parameter in this function is `Continuation<*>`. See [probeCoroutineCreated] for details.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@SinceKotlin("1.3")
|
@SinceKotlin("1.3")
|
||||||
internal fun probeCoroutineSuspended(frame: Continuation<*>) {
|
internal fun probeCoroutineSuspended(frame: Continuation<*>) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ private object CoroutineSuspendedMarker
|
|||||||
* state machine of the coroutine and may result in arbitrary behaviour or exception.
|
* state machine of the coroutine and may result in arbitrary behaviour or exception.
|
||||||
*/
|
*/
|
||||||
@SinceKotlin("1.3")
|
@SinceKotlin("1.3")
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
public actual fun <T> (suspend () -> T).createCoroutineUnintercepted(
|
public actual fun <T> (suspend () -> T).createCoroutineUnintercepted(
|
||||||
completion: Continuation<T>
|
completion: Continuation<T>
|
||||||
): Continuation<Unit> {
|
): Continuation<Unit> {
|
||||||
@@ -105,6 +106,7 @@ public actual fun <T> (suspend () -> T).createCoroutineUnintercepted(
|
|||||||
* state machine of the coroutine and may result in arbitrary behaviour or exception.
|
* state machine of the coroutine and may result in arbitrary behaviour or exception.
|
||||||
*/
|
*/
|
||||||
@SinceKotlin("1.3")
|
@SinceKotlin("1.3")
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
public actual fun <R, T> (suspend R.() -> T).createCoroutineUnintercepted(
|
public actual fun <R, T> (suspend R.() -> T).createCoroutineUnintercepted(
|
||||||
receiver: R,
|
receiver: R,
|
||||||
completion: Continuation<T>
|
completion: Continuation<T>
|
||||||
@@ -148,6 +150,7 @@ public actual fun <T> Continuation<T>.intercepted(): Continuation<T> =
|
|||||||
* The instance of [BaseContinuationImpl] is passed to the [block] so that it can be passed to the corresponding invocation.
|
* The instance of [BaseContinuationImpl] is passed to the [block] so that it can be passed to the corresponding invocation.
|
||||||
*/
|
*/
|
||||||
@SinceKotlin("1.3")
|
@SinceKotlin("1.3")
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
private inline fun <T> createCoroutineFromSuspendFunction(
|
private inline fun <T> createCoroutineFromSuspendFunction(
|
||||||
completion: Continuation<T>,
|
completion: Continuation<T>,
|
||||||
crossinline block: (Continuation<T>) -> Any?
|
crossinline block: (Continuation<T>) -> Any?
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ open class KProperty0Impl<out R>(override val name: String, override val returnT
|
|||||||
|
|
||||||
@FixmeReflection
|
@FixmeReflection
|
||||||
open class KProperty1Impl<T, out R>(override val name: String, override val returnType: KType, val getter: (T) -> R): KProperty1<T, R> {
|
open class KProperty1Impl<T, out R>(override val name: String, override val returnType: KType, val getter: (T) -> R): KProperty1<T, R> {
|
||||||
override fun get(p1: T): R {
|
override fun get(receiver: T): R {
|
||||||
return getter(p1)
|
return getter(receiver)
|
||||||
}
|
}
|
||||||
override fun invoke(p1: T): R {
|
override fun invoke(p1: T): R {
|
||||||
return getter(p1)
|
return getter(p1)
|
||||||
@@ -58,8 +58,8 @@ open class KProperty1Impl<T, out R>(override val name: String, override val retu
|
|||||||
|
|
||||||
@FixmeReflection
|
@FixmeReflection
|
||||||
open class KProperty2Impl<T1, T2, out R>(override val name: String, override val returnType: KType, val getter: (T1, T2) -> R): KProperty2<T1, T2, R> {
|
open class KProperty2Impl<T1, T2, out R>(override val name: String, override val returnType: KType, val getter: (T1, T2) -> R): KProperty2<T1, T2, R> {
|
||||||
override fun get(p1: T1, p2: T2): R {
|
override fun get(receiver1: T1, receiver2: T2): R {
|
||||||
return getter(p1, p2)
|
return getter(receiver1, receiver2)
|
||||||
}
|
}
|
||||||
override fun invoke(p1: T1, p2: T2): R {
|
override fun invoke(p1: T1, p2: T2): R {
|
||||||
return getter(p1, p2)
|
return getter(p1, p2)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class WeakReference<T : Any> {
|
|||||||
/**
|
/**
|
||||||
* Returns either reference to an object or null, if it was collected.
|
* Returns either reference to an object or null, if it was collected.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
public fun get(): T? = pointer?.get() as T?
|
public fun get(): T? = pointer?.get() as T?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ internal abstract class AbstractSet(val type: Int = 0) {
|
|||||||
val dummyNext = object : AbstractSet() {
|
val dummyNext = object : AbstractSet() {
|
||||||
override var next: AbstractSet
|
override var next: AbstractSet
|
||||||
get() = throw AssertionError("This method is not expected to be called.")
|
get() = throw AssertionError("This method is not expected to be called.")
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
set(value) {}
|
set(value) {}
|
||||||
override fun matches(startIndex: Int, testString: CharSequence, matchResult: MatchResultImpl) =
|
override fun matches(startIndex: Int, testString: CharSequence, matchResult: MatchResultImpl) =
|
||||||
throw AssertionError("This method is not expected to be called.")
|
throw AssertionError("This method is not expected to be called.")
|
||||||
|
|||||||
Reference in New Issue
Block a user