diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/CollectionStubMethodLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/CollectionStubMethodLowering.kt index 66a88db287d..9b627b0a39a 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/CollectionStubMethodLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/CollectionStubMethodLowering.kt @@ -313,7 +313,10 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl .flatMap { createStubFuns(irClass, it) } .mapTo(HashSet()) { it.toJvmSignature() } - return classStubFuns.filter { it.toJvmSignature() !in superClassStubSignatures } + return classStubFuns + .filter { it.toJvmSignature() !in superClassStubSignatures } + .associateBy { it.toJvmSignature() } + .values.toList() } private fun createStubFuns(irClass: IrClass, stubs: StubsForCollectionClass): List { diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet.kt new file mode 100644 index 00000000000..b43f15d7bfe --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME +// FULL_JDK + +import java.util.* + +class ListSet : List, Set { + override val size: Int get() = TODO() + override fun isEmpty(): Boolean = TODO() + override fun get(index: Int): E = TODO() + override fun contains(element: @UnsafeVariance E): Boolean = TODO() + override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean = TODO() + override fun indexOf(element: @UnsafeVariance E): Int = TODO() + override fun lastIndexOf(element: @UnsafeVariance E): Int = TODO() + override fun iterator(): Iterator = TODO() + override fun listIterator(): ListIterator = TODO() + override fun listIterator(index: Int): ListIterator = TODO() + override fun spliterator(): Spliterator<@UnsafeVariance E> = TODO() + override fun subList(fromIndex: Int, toIndex: Int): List = TODO() +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet.txt new file mode 100644 index 00000000000..9e889e63227 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet.txt @@ -0,0 +1,32 @@ +@kotlin.Metadata +public final class ListSet { + // source: 'ListAndSet.kt' + public method (): void + public method add(p0: int, p1: java.lang.Object): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: int, p1: java.util.Collection): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(@org.jetbrains.annotations.NotNull p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public @org.jetbrains.annotations.NotNull method get(p0: int): java.lang.Object + public method getSize(): int + public method indexOf(@org.jetbrains.annotations.NotNull p0: java.lang.Object): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method lastIndexOf(@org.jetbrains.annotations.NotNull p0: java.lang.Object): int + public @org.jetbrains.annotations.NotNull method listIterator(): java.util.ListIterator + public @org.jetbrains.annotations.NotNull method listIterator(p0: int): java.util.ListIterator + public method remove(p0: int): java.lang.Object + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method replaceAll(p0: java.util.function.UnaryOperator): void + public method retainAll(p0: java.util.Collection): boolean + public method set(p0: int, p1: java.lang.Object): java.lang.Object + public bridge final method size(): int + public method sort(p0: java.util.Comparator): void + public @org.jetbrains.annotations.NotNull method spliterator(): java.util.Spliterator + public @org.jetbrains.annotations.NotNull method subList(p0: int, p1: int): java.util.List + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet_ir.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet_ir.txt new file mode 100644 index 00000000000..547b26a7d2a --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet_ir.txt @@ -0,0 +1,32 @@ +@kotlin.Metadata +public final class ListSet { + // source: 'ListAndSet.kt' + public method (): void + public method add(p0: int, p1: java.lang.Object): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: int, p1: java.util.Collection): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public @org.jetbrains.annotations.NotNull method get(p0: int): java.lang.Object + public method getSize(): int + public method indexOf(@org.jetbrains.annotations.Nullable p0: java.lang.Object): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method lastIndexOf(@org.jetbrains.annotations.Nullable p0: java.lang.Object): int + public @org.jetbrains.annotations.NotNull method listIterator(): java.util.ListIterator + public @org.jetbrains.annotations.NotNull method listIterator(p0: int): java.util.ListIterator + public method remove(p0: int): java.lang.Object + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method replaceAll(p0: java.util.function.UnaryOperator): void + public method retainAll(p0: java.util.Collection): boolean + public method set(p0: int, p1: java.lang.Object): java.lang.Object + public bridge final method size(): int + public method sort(p0: java.util.Comparator): void + public @org.jetbrains.annotations.NotNull method spliterator(): java.util.Spliterator + public @org.jetbrains.annotations.NotNull method subList(p0: int, p1: int): java.util.List + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index a1e5951d85e..40454e58f67 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -440,6 +440,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/kt44233.kt"); } + @TestMetadata("ListAndSet.kt") + public void testListAndSet() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet.kt"); + } + @TestMetadata("mapOfPrimitivesFullJdk.kt") public void testMapOfPrimitivesFullJdk() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/mapOfPrimitivesFullJdk.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 3538229668d..8e298304579 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -440,6 +440,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/kt44233.kt"); } + @TestMetadata("ListAndSet.kt") + public void testListAndSet() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/ListAndSet.kt"); + } + @TestMetadata("mapOfPrimitivesFullJdk.kt") public void testMapOfPrimitivesFullJdk() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/mapOfPrimitivesFullJdk.kt");