提交 d0f26abd 编写于 作者: D Dmitry Petrov

JVM_IR KT-44798 don't generate multiple stubs with same signature

上级 9afe8a0a
......@@ -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<IrSimpleFunction> {
......
// WITH_RUNTIME
// FULL_JDK
import java.util.*
class ListSet<out E : Any> : List<E>, Set<E> {
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<E> = TODO()
override fun listIterator(): ListIterator<E> = TODO()
override fun listIterator(index: Int): ListIterator<E> = TODO()
override fun spliterator(): Spliterator<@UnsafeVariance E> = TODO()
override fun subList(fromIndex: Int, toIndex: Int): List<E> = TODO()
}
@kotlin.Metadata
public final class ListSet {
// source: 'ListAndSet.kt'
public method <init>(): 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[]
}
@kotlin.Metadata
public final class ListSet {
// source: 'ListAndSet.kt'
public method <init>(): 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[]
}
......@@ -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");
......
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册