Suppress CAST_NEVER_SUCCEEDS removed from standard library code
(cherry picked from commit 7d9aa04)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
b88282c0fc
commit
a2b68f65be
@@ -25,7 +25,7 @@ private object EmptyMap : Map<Any?, Nothing>, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Returns an empty read-only map of specified type. The returned map is serializable (JVM). */
|
/** Returns an empty read-only map of specified type. The returned map is serializable (JVM). */
|
||||||
public fun <K, V> emptyMap(): Map<K, V> = @Suppress("CAST_NEVER_SUCCEEDS") (EmptyMap as Map<K, V>)
|
public fun <K, V> emptyMap(): Map<K, V> = @Suppress("UNCHECKED_CAST") (EmptyMap as Map<K, V>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new read-only map with the specified contents, given as a list of pairs
|
* Returns a new read-only map with the specified contents, given as a list of pairs
|
||||||
|
|||||||
@@ -280,18 +280,18 @@ public inline fun <T: Comparable<T>> nullsLast(): Comparator<T?> = nullsLast(nat
|
|||||||
/**
|
/**
|
||||||
* Returns a comparator that compares [Comparable] objects in natural order.
|
* Returns a comparator that compares [Comparable] objects in natural order.
|
||||||
*/
|
*/
|
||||||
public fun <T: Comparable<T>> naturalOrder(): Comparator<T> = @Suppress("CAST_NEVER_SUCCEEDS") (NaturalOrderComparator as Comparator<T>)
|
public fun <T: Comparable<T>> naturalOrder(): Comparator<T> = @Suppress("UNCHECKED_CAST") (NaturalOrderComparator as Comparator<T>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a comparator that compares [Comparable] objects in reversed natural order.
|
* Returns a comparator that compares [Comparable] objects in reversed natural order.
|
||||||
*/
|
*/
|
||||||
public fun <T: Comparable<T>> reverseOrder(): Comparator<T> = @Suppress("CAST_NEVER_SUCCEEDS") (ReverseOrderComparator as Comparator<T>)
|
public fun <T: Comparable<T>> reverseOrder(): Comparator<T> = @Suppress("UNCHECKED_CAST") (ReverseOrderComparator as Comparator<T>)
|
||||||
|
|
||||||
/** Returns a comparator that imposes the reverse ordering of this comparator. */
|
/** Returns a comparator that imposes the reverse ordering of this comparator. */
|
||||||
public fun <T> Comparator<T>.reversed(): Comparator<T> = when (this) {
|
public fun <T> Comparator<T>.reversed(): Comparator<T> = when (this) {
|
||||||
is ReversedComparator -> this.comparator
|
is ReversedComparator -> this.comparator
|
||||||
NaturalOrderComparator -> @Suppress("CAST_NEVER_SUCCEEDS") (ReverseOrderComparator as Comparator<T>)
|
NaturalOrderComparator -> @Suppress("UNCHECKED_CAST") (ReverseOrderComparator as Comparator<T>)
|
||||||
ReverseOrderComparator -> @Suppress("CAST_NEVER_SUCCEEDS") (NaturalOrderComparator as Comparator<T>)
|
ReverseOrderComparator -> @Suppress("UNCHECKED_CAST") (NaturalOrderComparator as Comparator<T>)
|
||||||
else -> ReversedComparator(this)
|
else -> ReversedComparator(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user