diff --git a/compiler/testData/codegen/box/bridges/fakeOverrideFromInterfaceThroughIntermediateClass.kt b/compiler/testData/codegen/box/bridges/fakeOverrideFromInterfaceThroughIntermediateClass.kt index 09a3f7f25d6..698b6a8bf27 100644 --- a/compiler/testData/codegen/box/bridges/fakeOverrideFromInterfaceThroughIntermediateClass.kt +++ b/compiler/testData/codegen/box/bridges/fakeOverrideFromInterfaceThroughIntermediateClass.kt @@ -1,5 +1,3 @@ -// KT-4145 - interface A { fun foo(): Any } diff --git a/compiler/testData/codegen/box/bridges/strListRemove.kt b/compiler/testData/codegen/box/bridges/strListRemove.kt new file mode 100644 index 00000000000..59042369e91 --- /dev/null +++ b/compiler/testData/codegen/box/bridges/strListRemove.kt @@ -0,0 +1,104 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND: JVM_IR + +// FILE: J.java + +import java.util.*; + +public class J { + + public static String foo() { + List list = new KList(); + if (!list.remove(0).equals("OK")) return "fail"; + + return "OK"; + } +} + +// FILE: test.kt + +class KList : MutableList { + override val size: Int + get() = throw UnsupportedOperationException() + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun contains(o: String): Boolean { + throw UnsupportedOperationException() + } + override fun containsAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun get(index: Int): String { + throw UnsupportedOperationException() + } + + override fun indexOf(o: String): Int { + throw UnsupportedOperationException() + } + + override fun lastIndexOf(o: String): Int { + throw UnsupportedOperationException() + } + + override fun iterator(): MutableIterator { + throw UnsupportedOperationException() + } + + override fun add(e: String): Boolean { + throw UnsupportedOperationException() + } + + override fun remove(o: String): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(index: Int, c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun removeAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun retainAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun clear() { + throw UnsupportedOperationException() + } + + override fun set(index: Int, element: String): String { + throw UnsupportedOperationException() + } + + override fun add(index: Int, element: String) { + throw UnsupportedOperationException() + } + + override fun removeAt(index: Int): String { + return "OK" + } + + override fun listIterator(): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun listIterator(index: Int): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun subList(fromIndex: Int, toIndex: Int): MutableList { + throw UnsupportedOperationException() + } + +} +fun box() = J.foo() diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 9534443dff8..63913aa3c7f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -1411,6 +1411,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/bridges/strListContains.kt"); } + @TestMetadata("strListRemove.kt") + public void testStrListRemove() throws Exception { + runTest("compiler/testData/codegen/box/bridges/strListRemove.kt"); + } + @TestMetadata("traitImplInheritsTraitImpl.kt") public void testTraitImplInheritsTraitImpl() throws Exception { runTest("compiler/testData/codegen/box/bridges/traitImplInheritsTraitImpl.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 9acbf941168..6786f237b4f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -1411,6 +1411,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/bridges/strListContains.kt"); } + @TestMetadata("strListRemove.kt") + public void testStrListRemove() throws Exception { + runTest("compiler/testData/codegen/box/bridges/strListRemove.kt"); + } + @TestMetadata("traitImplInheritsTraitImpl.kt") public void testTraitImplInheritsTraitImpl() throws Exception { runTest("compiler/testData/codegen/box/bridges/traitImplInheritsTraitImpl.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 1be54e23f49..2e60502cda1 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -1411,6 +1411,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/bridges/strListContains.kt"); } + @TestMetadata("strListRemove.kt") + public void testStrListRemove() throws Exception { + runTest("compiler/testData/codegen/box/bridges/strListRemove.kt"); + } + @TestMetadata("traitImplInheritsTraitImpl.kt") public void testTraitImplInheritsTraitImpl() throws Exception { runTest("compiler/testData/codegen/box/bridges/traitImplInheritsTraitImpl.kt");