Create deprecated MutableList.sort extensions to guide how to replace them.
#KT-15790 Fixed
This commit is contained in:
+10
-4
@@ -5,9 +5,15 @@ abstract class A : MutableList<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun foo(x: MutableList<String>, y: java.util.ArrayList<String>, z: A, p: java.util.Comparator<in String>) {
|
fun foo(x: MutableList<String>, y: java.util.ArrayList<String>, z: A, p: java.util.Comparator<in String>) {
|
||||||
// Resolved to extension with no parameters
|
x.<!DEPRECATION_ERROR!>sort<!>(p)
|
||||||
x.sort(<!TOO_MANY_ARGUMENTS!>p<!>)
|
y.<!DEPRECATION_ERROR!>sort<!>(p)
|
||||||
y.sort(<!TOO_MANY_ARGUMENTS!>p<!>)
|
|
||||||
|
|
||||||
z.sort(<!TOO_MANY_ARGUMENTS!>p<!>)
|
z.<!DEPRECATION_ERROR!>sort<!>(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar(x: MutableList<String>, y: java.util.ArrayList<String>, z: A) {
|
||||||
|
x.<!DEPRECATION_ERROR!>sort<!> { a, b -> a.length - b.length }
|
||||||
|
y.<!DEPRECATION_ERROR!>sort<!> { a, b -> a.length - b.length }
|
||||||
|
|
||||||
|
z.<!DEPRECATION_ERROR!>sort<!> { a, b -> a.length - b.length }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package
|
package
|
||||||
|
|
||||||
|
public fun bar(/*0*/ x: kotlin.collections.MutableList<kotlin.String>, /*1*/ y: java.util.ArrayList<kotlin.String>, /*2*/ z: A): kotlin.Unit
|
||||||
public fun foo(/*0*/ x: kotlin.collections.MutableList<kotlin.String>, /*1*/ y: java.util.ArrayList<kotlin.String>, /*2*/ z: A, /*3*/ p: java.util.Comparator<in kotlin.String>): kotlin.Unit
|
public fun foo(/*0*/ x: kotlin.collections.MutableList<kotlin.String>, /*1*/ y: java.util.ArrayList<kotlin.String>, /*2*/ z: A, /*3*/ p: java.util.Comparator<in kotlin.String>): kotlin.Unit
|
||||||
|
|
||||||
public abstract class A : kotlin.collections.MutableList<kotlin.String> {
|
public abstract class A : kotlin.collections.MutableList<kotlin.String> {
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ public inline fun <@kotlin.internal.OnlyInputTypes T> MutableCollection<out T>.r
|
|||||||
@kotlin.internal.InlineOnly
|
@kotlin.internal.InlineOnly
|
||||||
public inline fun <T> MutableList<T>.remove(index: Int): T = removeAt(index)
|
public inline fun <T> MutableList<T>.remove(index: Int): T = removeAt(index)
|
||||||
|
|
||||||
|
@Deprecated("Use sortWith(comparator) instead.", ReplaceWith("this.sortWith(comparator)"), level = DeprecationLevel.ERROR)
|
||||||
|
@JvmVersion
|
||||||
|
@kotlin.internal.InlineOnly
|
||||||
|
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)
|
||||||
|
@JvmVersion
|
||||||
|
@kotlin.internal.InlineOnly
|
||||||
|
public inline fun <T> MutableList<T>.sort(comparison: (T, T) -> Int): Unit = throw NotImplementedError()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the specified [element] to this mutable collection.
|
* Adds the specified [element] to this mutable collection.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user