diff --git a/compiler/testData/codegen/box/builtinStubMethods/ListWithAllImplementations.kt b/compiler/testData/codegen/box/builtinStubMethods/ListWithAllImplementations.kt index b9d7cc9a293..3243cf6f4cd 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/ListWithAllImplementations.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/ListWithAllImplementations.kt @@ -14,7 +14,7 @@ class MyList(val v: T): List { override fun equals(other: Any?): Boolean = false public fun add(e: T): Boolean = true - public fun remove(o: Any?): Boolean = true + public fun remove(o: T): Boolean = true public fun addAll(c: Collection): Boolean = true public fun addAll(index: Int, c: Collection): Boolean = true public fun removeAll(c: Collection): Boolean = true @@ -22,7 +22,7 @@ class MyList(val v: T): List { public fun clear() {} public fun set(index: Int, element: T): T = element public fun add(index: Int, element: T) {} - public fun remove(index: Int): T = v + public fun removeAt(index: Int): T = v } fun box(): String { diff --git a/compiler/testData/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt b/compiler/testData/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt index 54fabc3117e..e119905d3a1 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/ListWithAllInheritedImplementations.kt @@ -1,6 +1,6 @@ open class Super(val v: T) { public fun add(e: T): Boolean = true - public fun remove(o: Any?): Boolean = true + public fun remove(o: T): Boolean = true public fun addAll(c: Collection): Boolean = true public fun addAll(index: Int, c: Collection): Boolean = true public fun removeAll(c: Collection): Boolean = true @@ -8,7 +8,7 @@ open class Super(val v: T) { public fun clear() {} public fun set(index: Int, element: T): T = element public fun add(index: Int, element: T) {} - public fun remove(index: Int): T = v + public fun removeAt(index: Int): T = v } class MyList(v: T): Super(v), List { diff --git a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt index 255cbbaf192..8cb8e547f7f 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/arrayList.kt @@ -17,7 +17,7 @@ fun box(): String { a.add("") a.set(0, "") a.add(0, "") - a.remove(0) + a.removeAt(0) a.remove("") return "OK" diff --git a/compiler/testData/codegen/box/builtinStubMethods/inheritedImplementations.kt b/compiler/testData/codegen/box/builtinStubMethods/inheritedImplementations.kt index 2ff81b7308b..b61db7301d3 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/inheritedImplementations.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/inheritedImplementations.kt @@ -1,6 +1,6 @@ open class SetStringImpl { fun add(s: String): Boolean = false - fun remove(o: Any?): Boolean = false + fun remove(o: String): Boolean = false fun clear(): Unit {} } diff --git a/compiler/testData/codegen/box/builtinsProperties/collectionImpl.kt b/compiler/testData/codegen/box/builtinsProperties/collectionImpl.kt index 4bc827ba41b..d836700317e 100644 --- a/compiler/testData/codegen/box/builtinsProperties/collectionImpl.kt +++ b/compiler/testData/codegen/box/builtinsProperties/collectionImpl.kt @@ -22,7 +22,7 @@ class A1 : MutableCollection { throw UnsupportedOperationException() } - override fun remove(o: Any?): Boolean { + override fun remove(o: String): Boolean { throw UnsupportedOperationException() } diff --git a/compiler/testData/codegen/box/extensionFunctions/simple.kt b/compiler/testData/codegen/box/extensionFunctions/simple.kt index fd45243eab5..101e52661bf 100644 --- a/compiler/testData/codegen/box/extensionFunctions/simple.kt +++ b/compiler/testData/codegen/box/extensionFunctions/simple.kt @@ -1,4 +1,4 @@ -fun StringBuilder.first() = this.charAt(0) +fun StringBuilder.first() = this.get(0) fun foo() = StringBuilder("foo").first() diff --git a/compiler/testData/codegen/box/extensionFunctions/whenFail.kt b/compiler/testData/codegen/box/extensionFunctions/whenFail.kt index a3d6beb6208..e26924496c1 100644 --- a/compiler/testData/codegen/box/extensionFunctions/whenFail.kt +++ b/compiler/testData/codegen/box/extensionFunctions/whenFail.kt @@ -1,6 +1,6 @@ fun StringBuilder.takeFirst(): Char { if (this.length() == 0) return 0.toChar() - val c = this.charAt(0) + val c = this.get(0) this.deleteCharAt(0) return c } diff --git a/compiler/testData/codegen/box/intrinsics/infixCall.kt b/compiler/testData/codegen/box/intrinsics/infixCall.kt index 275d18756c9..e385f75688d 100644 --- a/compiler/testData/codegen/box/intrinsics/infixCall.kt +++ b/compiler/testData/codegen/box/intrinsics/infixCall.kt @@ -1,5 +1,5 @@ fun box(): String { - val o = "OK" charAt 0 + val o = "OK" get 0 val array = CharArray(2) array[1] = 'K' val k = array get 1 diff --git a/compiler/testData/codegen/box/strings/kt5956.kt b/compiler/testData/codegen/box/strings/kt5956.kt index d3bb27017da..4a514d35813 100644 --- a/compiler/testData/codegen/box/strings/kt5956.kt +++ b/compiler/testData/codegen/box/strings/kt5956.kt @@ -1,7 +1,7 @@ // KT-5956 java.lang.AbstractMethodError: test.Thing.subSequence(II)Ljava/lang/CharSequence class Thing(val delegate: CharSequence) : CharSequence { - override fun charAt(index: Int): Char { + override fun get(index: Int): Char { throw UnsupportedOperationException() } override fun length(): Int = 0 diff --git a/compiler/testData/codegen/boxWithJava/collections/mutableList/mutableList.kt b/compiler/testData/codegen/boxWithJava/collections/mutableList/mutableList.kt index 7e00a59f05c..b938eb3bc83 100644 --- a/compiler/testData/codegen/boxWithJava/collections/mutableList/mutableList.kt +++ b/compiler/testData/codegen/boxWithJava/collections/mutableList/mutableList.kt @@ -3,7 +3,7 @@ open class KList : MutableList { throw UnsupportedOperationException() } - override fun remove(o: Any?): Boolean { + override fun remove(o: E): Boolean { throw UnsupportedOperationException() } @@ -35,7 +35,7 @@ open class KList : MutableList { throw UnsupportedOperationException() } - override fun remove(index: Int): E { + override fun removeAt(index: Int): E { throw UnsupportedOperationException() } diff --git a/compiler/testData/codegen/boxWithJava/collections/strList/strList.kt b/compiler/testData/codegen/boxWithJava/collections/strList/strList.kt index b1656f2fb66..9f15d939273 100644 --- a/compiler/testData/codegen/boxWithJava/collections/strList/strList.kt +++ b/compiler/testData/codegen/boxWithJava/collections/strList/strList.kt @@ -29,7 +29,7 @@ open class KList : MutableList { throw UnsupportedOperationException() } - override fun remove(o: Any?): Boolean { + override fun remove(o: String): Boolean { throw UnsupportedOperationException() } @@ -61,7 +61,7 @@ open class KList : MutableList { throw UnsupportedOperationException() } - override fun remove(index: Int): String { + override fun removeAt(index: Int): String { throw UnsupportedOperationException() } diff --git a/compiler/testData/diagnostics/tests/library/Collections.kt b/compiler/testData/diagnostics/tests/library/Collections.kt index 809e7786e86..fa539a3b6f6 100644 --- a/compiler/testData/diagnostics/tests/library/Collections.kt +++ b/compiler/testData/diagnostics/tests/library/Collections.kt @@ -26,7 +26,7 @@ fun testMutableCollection(c: MutableCollection, t: T) { val mutableIterator: MutableIterator = c.iterator() c.add(t) - c.remove(1) + c.remove(1 as T) c.addAll(c) c.removeAll(c) c.retainAll(c) @@ -52,7 +52,7 @@ fun testList(l: List, t: T) { fun testMutableList(l: MutableList, t: T) { val value: T = l.set(1, t) l.add(1, t) - l.remove(1) + l.removeAt(1) val mutableListIterator: MutableListIterator = l.listIterator() val mutableListIterator1: MutableListIterator = l.listIterator(1) val mutableList: MutableList = l.subList(1, 2) @@ -84,7 +84,7 @@ fun testMutableSet(s: MutableSet, t: T) { val mutableIterator: MutableIterator = s.iterator() s.add(t) - s.remove(1) + s.remove(1 as T) s.addAll(s) s.removeAll(s) s.retainAll(s) diff --git a/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt b/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt index db7afd30edd..6fcbf059c48 100644 --- a/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt +++ b/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt @@ -3,7 +3,7 @@ import java.util.* import java.io.* fun takeFirst(expr: StringBuilder): Char { - val c = expr.charAt(0) + val c = expr.get(0) expr.deleteCharAt(0) return c } @@ -31,7 +31,7 @@ fun evaluateAdd(expr: StringBuilder, numbers: ArrayList): Int { fun evaluate(expr: StringBuilder, numbers: ArrayList): Int { val lhs = evaluateAdd(expr, numbers) if (expr.length() > 0) { - val c = expr.charAt(0) + val c = expr.get(0) expr.deleteCharAt(0) } return lhs diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/extensionCall.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/extensionCall.kt index e1ba3e3a11e..05e303c791e 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/extensionCall.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/extensionCall.kt @@ -2,5 +2,5 @@ fun String.bar(s: String) = s fun foo(s: String?) { s?.bar(s) - s?.charAt(s.length()) + s?.get(s.length()) } \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/PackageGenTest.java b/compiler/tests/org/jetbrains/kotlin/codegen/PackageGenTest.java index 8502f3609f9..2841602975e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/PackageGenTest.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/PackageGenTest.java @@ -384,7 +384,7 @@ public class PackageGenTest extends CodegenTestCase { } public void testCallMethodDeclaredInSuperclass() throws Exception { - loadText("fun foo(sb: StringBuilder) = sb.charAt(0)"); + loadText("fun foo(sb: StringBuilder) = sb.get(0)"); Method main = generateFunction(); StringBuilder sb = new StringBuilder("x"); assertEquals('x', ((Character) main.invoke(null, sb)).charValue()); diff --git a/idea/idea-completion/testData/basic/java/boldOrGrayed/ImmediateMembersForPlatformType.kt b/idea/idea-completion/testData/basic/java/boldOrGrayed/ImmediateMembersForPlatformType.kt index 92928d5c5f1..5ed0c7fe81b 100644 --- a/idea/idea-completion/testData/basic/java/boldOrGrayed/ImmediateMembersForPlatformType.kt +++ b/idea/idea-completion/testData/basic/java/boldOrGrayed/ImmediateMembersForPlatformType.kt @@ -11,4 +11,4 @@ class C { // EXIST: { itemText: "extFunForString", attributes: "bold" } // EXIST: { itemText: "extFunForAny", attributes: "" } // EXIST: { itemText: "extFunForStringNullable", attributes: "bold" } -// EXIST: { itemText: "charAt", attributes: "" } +// EXIST: { itemText: "get", attributes: "" } diff --git a/idea/testData/checker/regression/DoubleDefine.kt b/idea/testData/checker/regression/DoubleDefine.kt index f4582304ae7..f6f269b27d2 100644 --- a/idea/testData/checker/regression/DoubleDefine.kt +++ b/idea/testData/checker/regression/DoubleDefine.kt @@ -3,7 +3,7 @@ import java.util.* import java.io.* fun takeFirst(expr: StringBuilder): Char { - val c = expr.charAt(0) + val c = expr.get(0) expr.deleteCharAt(0) return c } @@ -31,7 +31,7 @@ fun evaluateAdd(expr: StringBuilder, numbers: ArrayList): Int { fun evaluate(expr: StringBuilder, numbers: ArrayList): Int { val lhs = evaluateAdd(expr, numbers) if (expr.length() > 0) { - val c = expr.charAt(0) + val c = expr.get(0) expr.deleteCharAt(0) } return lhs diff --git a/js/js.translator/testData/java/arrayList/cases/misc.kt b/js/js.translator/testData/java/arrayList/cases/misc.kt index 8205eac5fbd..6f80078db1c 100644 --- a/js/js.translator/testData/java/arrayList/cases/misc.kt +++ b/js/js.translator/testData/java/arrayList/cases/misc.kt @@ -11,7 +11,7 @@ fun box(): Boolean { // test addAt list.add(0, 400) - list.remove(0); + list.removeAt(0); list.add(1, 500) // test contains, addAll if (!list.contains(500) || list.contains(600) || list.addAll(ArrayList())) { diff --git a/js/js.translator/testData/java/arrayList/cases/remove.kt b/js/js.translator/testData/java/arrayList/cases/remove.kt index 221ee4b8580..5bba7ae689d 100644 --- a/js/js.translator/testData/java/arrayList/cases/remove.kt +++ b/js/js.translator/testData/java/arrayList/cases/remove.kt @@ -8,7 +8,7 @@ fun box(): Boolean { arr.add(i) } - val removedElement = arr.remove(2) - val removed = arr.remove(4: Any) + val removedElement = arr.removeAt(2) + val removed = arr.remove(4) return arr.size() == 4 && removedElement == 2 && removed && arr[0] == 0 && arr[1] == 1 && arr[2] == 3 && arr[3] == 5 } \ No newline at end of file diff --git a/js/js.translator/testData/java/arrayList/cases/removeWithIndexOutOfBounds.kt b/js/js.translator/testData/java/arrayList/cases/removeWithIndexOutOfBounds.kt index 1a814b54788..cd2c16ead69 100644 --- a/js/js.translator/testData/java/arrayList/cases/removeWithIndexOutOfBounds.kt +++ b/js/js.translator/testData/java/arrayList/cases/removeWithIndexOutOfBounds.kt @@ -7,7 +7,7 @@ fun box(): Boolean { val arr = ArrayList() try { - arr.remove(2) + arr.removeAt(2) } catch(e: IndexOutOfBoundsException) { threwForEmptyList = true @@ -20,7 +20,7 @@ fun box(): Boolean { var threwForFilled = false try { - arr.remove(20) + arr.removeAt(20) } catch(e: IndexOutOfBoundsException) { threwForFilled = true