Fix compilation in the case of JDK_16 pointing to JDK 1.8

This commit is contained in:
Alexander Udalov
2021-01-13 21:47:23 +01:00
parent 3be62dfc89
commit a6b51da308
3 changed files with 5 additions and 2 deletions
@@ -11,7 +11,7 @@ package kotlin.collections
@Deprecated("Use sortWith(comparator) instead.", ReplaceWith("this.sortWith(comparator)"), level = DeprecationLevel.ERROR) @Deprecated("Use sortWith(comparator) instead.", ReplaceWith("this.sortWith(comparator)"), level = DeprecationLevel.ERROR)
@kotlin.internal.InlineOnly @kotlin.internal.InlineOnly
@Suppress("UNUSED_PARAMETER") @Suppress("UNUSED_PARAMETER", "EXTENSION_SHADOWED_BY_MEMBER")
public inline fun <T> MutableList<T>.sort(comparator: Comparator<in T>): Unit = throw NotImplementedError() public inline fun <T> MutableList<T>.sort(comparator: Comparator<in T>): Unit = throw NotImplementedError()
@Deprecated("Use sortWith(Comparator(comparison)) instead.", ReplaceWith("this.sortWith(Comparator(comparison))"), level = DeprecationLevel.ERROR) @Deprecated("Use sortWith(Comparator(comparison)) instead.", ReplaceWith("this.sortWith(Comparator(comparison))"), level = DeprecationLevel.ERROR)
@@ -97,7 +97,9 @@ private val KTypeProjection.javaType: Type
@ExperimentalStdlibApi @ExperimentalStdlibApi
private interface TypeImpl : Type { private interface TypeImpl : Type {
// This is a copy of [Type.getTypeName] which is present on JDK 8+. // This is a copy of [Type.getTypeName] which is present on JDK 8+.
@Suppress("VIRTUAL_MEMBER_HIDDEN") // This is needed for cases when environment variable JDK_16 points to JDK 8+. @Suppress(
"VIRTUAL_MEMBER_HIDDEN", "NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT"
) // This is needed for cases when environment variable JDK_16 points to JDK 8+.
fun getTypeName(): String fun getTypeName(): String
} }
@@ -291,6 +291,7 @@ public fun <T : Comparable<T>> reverseOrder(): Comparator<T> = @Suppress("UNCHEC
* *
* @sample samples.comparisons.Comparisons.reversed * @sample samples.comparisons.Comparisons.reversed
*/ */
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
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("UNCHECKED_CAST") (ReverseOrderComparator as Comparator<T>) NaturalOrderComparator -> @Suppress("UNCHECKED_CAST") (ReverseOrderComparator as Comparator<T>)