diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index ecaf434d3bf..3a09ae2af5a 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -5028,6 +5028,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/collections/removeClashKotlin.kt"); } + @TestMetadata("removeClashWithGenerics.kt") + public void testRemoveClashWithGenerics() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeClashWithGenerics.kt"); + } + @TestMetadata("removeOverriddenInJava.kt") public void testRemoveOverriddenInJava() throws Exception { runTest("compiler/testData/codegen/box/collections/removeOverriddenInJava.kt"); diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/util/IrTypeUtils.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/util/IrTypeUtils.kt index 6905fc08e0c..e3e82d5f367 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/util/IrTypeUtils.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/util/IrTypeUtils.kt @@ -82,7 +82,9 @@ fun IrType.substitute(params: List, arguments: List): I fun IrType.substitute(substitutionMap: Map): IrType { if (this !is IrSimpleType) return this - substitutionMap[classifier]?.let { return it } + substitutionMap[classifier]?.let { + return it.withHasQuestionMark(hasQuestionMark || it is IrSimpleType && it.hasQuestionMark) + } val newArguments = arguments.map { if (it is IrTypeProjection) { @@ -101,27 +103,39 @@ fun IrType.substitute(substitutionMap: Map): IrTy ) } -private fun getImmediateSupertypes(irClass: IrClass): List { +private fun getImmediateSupertypes(irType: IrSimpleType): List { + val irClass = irType.getClass() + ?: throw AssertionError("Not a class type: ${irType.render()}") val originalSupertypes = irClass.superTypes - val args = irClass.defaultType.arguments.mapNotNull { (it as? IrTypeProjection)?.type } + val arguments = + irType.arguments.map { + it.typeOrNull + ?: throw AssertionError("*-projection in supertype arguments: ${irType.render()}") + } return originalSupertypes .filter { it.classOrNull != null } .map { superType -> - superType.substitute(superType.classOrNull!!.owner.typeParameters, args) as IrSimpleType + superType.substitute(irClass.typeParameters, arguments) as IrSimpleType } } -private fun collectAllSupertypes(irClass: IrClass, result: MutableSet) { - val immediateSupertypes = getImmediateSupertypes(irClass) +private fun collectAllSupertypes(irType: IrSimpleType, result: MutableSet) { + val immediateSupertypes = getImmediateSupertypes(irType) result.addAll(immediateSupertypes) for (supertype in immediateSupertypes) { - collectAllSupertypes(supertype.classOrNull!!.owner, result) + collectAllSupertypes(supertype, result) } } -fun getAllSupertypes(irClass: IrClass): MutableSet { +// Given the following classes: +// open class A +// open class B : A> +// class C : B> +// for the class C, this function constructs: +// { B>, A>, Any } +// where Z is a type parameter of class C. +fun getAllSubstitutedSupertypes(irClass: IrClass): MutableSet { val result = HashSet() - - collectAllSupertypes(irClass, result) + collectAllSupertypes(irClass.defaultType, result) return result } 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 87f2a71c472..16aa00c1449 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 @@ -38,6 +38,15 @@ internal val collectionStubMethodLowering = makeIrFilePhase( internal class CollectionStubMethodLowering(val context: JvmBackendContext) : ClassLoweringPass { private val collectionStubComputer = context.collectionStubComputer + private data class NameAndArity( + val name: Name, + val typeParametersCount: Int, + val valueParametersCount: Int + ) + + private val IrSimpleFunction.nameAndArity + get() = NameAndArity(name, typeParameters.size, valueParameters.size) + override fun lower(irClass: IrClass) { if (irClass.isInterface) { return @@ -49,60 +58,64 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl // We don't need to generate stub for existing methods, but for FAKE_OVERRIDE methods with ABSTRACT modality, // it means an abstract function in superclass that is not implemented yet, // stub generation is still needed to avoid invocation error. - val existingMethodsBySignature = irClass.functions.filterNot { - it.modality == Modality.ABSTRACT && it.isFakeOverride - }.associateBy { it.toJvmSignature() } + val existingMethodsByNameAndArity = irClass.functions + .filterNot { it.modality == Modality.ABSTRACT && it.isFakeOverride } + .groupBy { it.nameAndArity } - for (member in methodStubsToGenerate) { - val signature = member.toJvmSignature() - val existingMethod = existingMethodsBySignature[signature] - if (existingMethod != null && areEquivalentSignatures(existingMethod, member)) { - // In the case that we find a defined method that matches the stub signature, we add the overridden symbols to that - // defined method, so that bridge lowering can still generate correct bridge for that method - existingMethod.overriddenSymbols += member.overriddenSymbols - } else { - // Some stub members require special handling. - // In both 'remove' and 'removeAt' cases there are no other member functions with same name in built-in mutable collection - // classes, so it's safe to check for the member name itself. - when (member.name.asString()) { - "remove" -> { - // - 'remove' member functions: - // kotlin.collections.MutableCollection#remove(E): Boolean - // kotlin.collections.MutableMap#remove(K): V? - // We've checked that corresponding 'remove(T)' member function is not present in the class. - // We should add a member function that overrides, respectively: - // java.util.Collection#remove(Object): boolean - // java.util.Map#remove(K): V - // This corresponds to replacing value parameter types with 'Any?'. - irClass.declarations.add(member.apply { - valueParameters = valueParameters.map { - it.copyWithCustomTypeSubstitution(this) { context.irBuiltIns.anyNType } - } - }) - } - "removeAt" -> { - // - 'removeAt' member function: - // kotlin.collections.MutableList#removeAt(Int): E - // We've checked that corresponding 'removeAt(Int)' member function is not present in the class - // (if it IS present, special bridges for 'remove(I)' would be generated later in BridgeLowering). - // We can't add 'removeAt' here, because it would be different from what old back-end generates - // and can break existing Java and/or Kotlin code. - // We should add a member function that overrides - // java.util.List#remove(int): E - // and throws UnsupportedOperationException, just like any other stub. - // Also, we should generate a bridge for it if required. - val removeIntFun = createRemoveAtStub(member, member.returnType, IrDeclarationOrigin.IR_BUILTINS_STUB) - irClass.declarations.add(removeIntFun) - val removeIntBridgeFun = createRemoveAtStub(member, context.irBuiltIns.anyNType, IrDeclarationOrigin.BRIDGE) - if (removeIntBridgeFun.toJvmSignature() != removeIntFun.toJvmSignature()) { - irClass.declarations.add(removeIntBridgeFun) - } - } - else -> - irClass.declarations.add(member) - } + for (stub in methodStubsToGenerate) { + val relevantMembers = existingMethodsByNameAndArity[stub.nameAndArity].orEmpty() + val existingOverrides = relevantMembers.filter { isStubOverriddenByExistingFun(stub, it) } + if (existingOverrides.isNotEmpty()) { + // In the case that we find a defined method that matches the stub signature, + // we add the overridden symbols to that defined method, + // so that bridge lowering can still generate correct bridge for that method. + existingOverrides.forEach { it.overriddenSymbols += stub.overriddenSymbols } + continue } + + // Some stub members require special handling. + // In both 'remove' and 'removeAt' cases there are no other member functions with same name in built-in mutable collection + // classes, so it's safe to check for the member name itself. + when (stub.name.asString()) { + "remove" -> { + // - 'remove' member functions: + // kotlin.collections.MutableCollection#remove(E): Boolean + // kotlin.collections.MutableMap#remove(K): V? + // We've checked that corresponding 'remove(T)' member function is not present in the class. + // We should add a member function that overrides, respectively: + // java.util.Collection#remove(Object): boolean + // java.util.Map#remove(K): V + // This corresponds to replacing value parameter types with 'Any?'. + irClass.declarations.add(stub.apply { + valueParameters = valueParameters.map { + it.copyWithCustomTypeSubstitution(this) { context.irBuiltIns.anyNType } + } + }) + } + "removeAt" -> { + // - 'removeAt' member function: + // kotlin.collections.MutableList#removeAt(Int): E + // We've checked that corresponding 'removeAt(Int)' member function is not present in the class + // (if it IS present, special bridges for 'remove(I)' would be generated later in BridgeLowering). + // We can't add 'removeAt' here, because it would be different from what old back-end generates + // and can break existing Java and/or Kotlin code. + // We should add a member function that overrides + // java.util.List#remove(int): E + // and throws UnsupportedOperationException, just like any other stub. + // Also, we should generate a bridge for it if required. + val removeIntFun = createRemoveAtStub(stub, stub.returnType, IrDeclarationOrigin.IR_BUILTINS_STUB) + irClass.declarations.add(removeIntFun) + val removeIntBridgeFun = createRemoveAtStub(stub, context.irBuiltIns.anyNType, IrDeclarationOrigin.BRIDGE) + if (removeIntBridgeFun.toJvmSignature() != removeIntFun.toJvmSignature()) { + irClass.declarations.add(removeIntBridgeFun) + } + } + else -> + irClass.declarations.add(stub) + } + + } } @@ -138,7 +151,7 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl ): IrSimpleFunction { return context.irFactory.buildFun { name = function.name - returnType = function.returnType.substitute(substitutionMap) + returnType = liftStubMethodReturnType(function).substitute(substitutionMap) visibility = function.visibility origin = IrDeclarationOrigin.IR_BUILTINS_STUB modality = Modality.OPEN @@ -154,6 +167,18 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl } } + private fun liftStubMethodReturnType(function: IrSimpleFunction) = + when (function.name.asString()) { + "iterator" -> + context.ir.symbols.iterator.typeWithArguments(function.returnType.cast().arguments) + "listIterator" -> + context.ir.symbols.listIterator.typeWithArguments(function.returnType.cast().arguments) + "subList" -> + context.ir.symbols.list.typeWithArguments(function.returnType.cast().arguments) + else -> + function.returnType + } + private fun createThrowingStubBody(function: IrSimpleFunction) = context.createIrBuilder(function.symbol).irBlockBody { // Function body consist only of throwing UnsupportedOperationException statement @@ -163,33 +188,66 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl } } - private fun areEquivalentSignatures(fun1: IrSimpleFunction, fun2: IrSimpleFunction): Boolean { - if (fun1.typeParameters.size != fun2.typeParameters.size) return false - if (fun1.valueParameters.size != fun2.valueParameters.size) return false - val typeChecker = IrTypeCheckerContextWithAdditionalAxioms(context.irBuiltIns, fun1.typeParameters, fun2.typeParameters) - .cast() - return fun1.valueParameters.zip(fun2.valueParameters) + private fun isStubOverriddenByExistingFun(stubFun: IrSimpleFunction, existingFun: IrSimpleFunction): Boolean { + // We don't add a throwing stub if it's effectively overridden by an existing function. + // This is true if all of the following conditions are met, + // assuming type parameter Ti of the existing function is "equal" to type parameter Si of the generated stub: + // - names are same; + // - existing function has the same number of type parameters, + // and upper bounds for type parameters are equivalent; + // - existing function has the same number of value parameters, + // and types for value parameters are equivalent; + // - return type of the existing function is a subtype of return type of the generated stub. + + if (stubFun.name != existingFun.name) return false + if (stubFun.typeParameters.size != existingFun.typeParameters.size) return false + if (stubFun.valueParameters.size != existingFun.valueParameters.size) return false + + val typeChecker = createTypeChecker(stubFun, existingFun) + + // Note that type parameters equivalence check doesn't really happen on collection stubs + // (because members of Kotlin built-in collection classes don't have type parameters of their own), + // but we keep it here for the sake of consistency. + if (!areTypeParametersEquivalent(existingFun, stubFun, typeChecker)) return false + + if (!areValueParametersEquivalent(existingFun, stubFun, typeChecker)) return false + if (!isReturnTypeOverrideCompliant(existingFun, stubFun, typeChecker)) return false + + return true + } + + private fun createTypeChecker(overrideFun: IrSimpleFunction, parentFun: IrSimpleFunction): AbstractTypeCheckerContext = + IrTypeCheckerContextWithAdditionalAxioms(context.irBuiltIns, overrideFun.typeParameters, parentFun.typeParameters) + + private fun areTypeParametersEquivalent( + overrideFun: IrSimpleFunction, + parentFun: IrSimpleFunction, + typeChecker: AbstractTypeCheckerContext + ): Boolean = + overrideFun.typeParameters.zip(parentFun.typeParameters) + .all { (typeParameter1, typeParameter2) -> + typeParameter1.superTypes.zip(typeParameter2.superTypes) + .all { (supertype1, supertype2) -> + AbstractTypeChecker.equalTypes(typeChecker, supertype1, supertype2) + } + } + + private fun areValueParametersEquivalent( + overrideFun: IrSimpleFunction, + parentFun: IrSimpleFunction, + typeChecker: AbstractTypeCheckerContext + ): Boolean = + overrideFun.valueParameters.zip(parentFun.valueParameters) .all { (valueParameter1, valueParameter2) -> AbstractTypeChecker.equalTypes(typeChecker, valueParameter1.type, valueParameter2.type) } - } - private fun IrSimpleFunction.hackRemoveMethodIfRequired(): IrSimpleFunction { - // NB 'remove' method requires some special handling: - // - we check that 'remove(T)' is present in the class, where 'T' is a type argument of the collection type - // (this matches the signature of the method created above); - // - if it is absent, we add 'remove(Any?)' member function, - // which corresponds to method 'remove' in java.util.Collection and java.util.Map. - if (name.asString() == "remove") { - // Note that replacing value parameter types with 'Any?' handles both MutableCollection and MutableMap case: - // java.util.Collection#remove has signature 'boolean remove(Object)', and - // java.util.Map#remove has signature 'V remove(Object)'. - valueParameters = valueParameters.map { - it.copyWithCustomTypeSubstitution(this) { context.irBuiltIns.anyNType } - } - } - return this - } + internal fun isReturnTypeOverrideCompliant( + overrideFun: IrSimpleFunction, + parentFun: IrSimpleFunction, + typeChecker: AbstractTypeCheckerContext + ): Boolean = + AbstractTypeChecker.isSubtypeOf(typeChecker, overrideFun.returnType, parentFun.returnType) // Copy value parameter with type substitution private fun IrValueParameter.copyWithSubstitution( @@ -221,7 +279,7 @@ internal class CollectionStubMethodLowering(val context: JvmBackendContext) : Cl // We find the most specific type for the immutable collection class from the inheritance chain of target class // Perform type substitution along searching, then use the type arguments obtained from the most specific type // for type substitution. - val readOnlyClassType = getAllSupertypes(targetClass).findMostSpecificTypeForClass(readOnlyClass.symbol) + val readOnlyClassType = getAllSubstitutedSupertypes(targetClass).findMostSpecificTypeForClass(readOnlyClass.symbol) val readOnlyClassTypeArguments = (readOnlyClassType as IrSimpleType).arguments.mapNotNull { (it as? IrTypeProjection)?.type } if (readOnlyClassTypeArguments.isEmpty() || readOnlyClassTypeArguments.size != mutableClass.typeParameters.size) { @@ -281,20 +339,13 @@ internal class CollectionStubComputer(val context: JvmBackendContext) { val readOnlyClass: IrClassSymbol, val mutableClass: IrClassSymbol ) { - // Preserve old backend's logic to generate stubs for special cases where a mutable method - // has the same JVM signature as the immutable method. See KT-36724 for more details. - private val specialCaseStubSignaturesForOldBackend = setOf( - "listIterator()Ljava/util/ListIterator;", - "listIterator(I)Ljava/util/ListIterator;", - "subList(II)Ljava/util/List;" - ) val mutableOnlyMethods: Collection by lazy { - val readOnlyMethodSignatures = readOnlyClass - .functions - .map { getJvmSignature(it.owner) } - .filter { it !in specialCaseStubSignaturesForOldBackend } - .toHashSet() + val readOnlyMethodSignatures = + readOnlyClass.functions + .filter { !it.owner.isSpecialCaseStubForOldBackend() } + .map { getJvmSignature(it.owner) } + .toHashSet() mutableClass.functions .map { it.owner } .filter { getJvmSignature(it) !in readOnlyMethodSignatures } @@ -306,6 +357,32 @@ internal class CollectionStubComputer(val context: JvmBackendContext) { operator fun component3() = mutableOnlyMethods } + // Preserve old backend's logic to generate stubs for special cases where a mutable method + // has the same JVM signature as the immutable method. See KT-36724 for more details. + private fun IrSimpleFunction.isSpecialCaseStubForOldBackend(): Boolean { + return when (name.asString()) { + "iterator" -> { + val parentClassSymbol = parentAsClass.symbol + // Due to the specific way Kotlin built-in collection classes are written, + // old JVM back-end generates throwing method stubs for the following abstract member functions: + // Iterable#iterator(): Iterator + // Collection#iterator(): Iterator + // Set#iterator(): Iterator + // This happens because MutableIterable, MutableCollection, and MutableSet contain explicit override + // override fun iterator(): MutableIterator + // and MutableList doesn't, which makes corresponding member of MutableList a FAKE_OVERRIDE. + with(context.ir.symbols) { + // Note that here we are looking at a read-only collection member. + parentClassSymbol == iterable || parentClassSymbol == collection || parentClassSymbol == set + } + } + "listIterator", "subList" -> + true + else -> + false + } + } + private val preComputedStubs: Collection by lazy { with(context.ir.symbols) { listOf( diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt index 87ca6aa9f5a..12aadbf567c 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt @@ -139,6 +139,9 @@ fun IrClassifierSymbol.typeWith(arguments: List): IrSimpleType = emptyList() ) +fun IrClassifierSymbol.typeWithArguments(arguments: List): IrSimpleType = + IrSimpleTypeImpl(this, false, arguments, emptyList()) + fun IrClass.typeWith(arguments: List) = this.symbol.typeWith(arguments) fun IrClass.typeWith(vararg arguments: IrType) = this.symbol.typeWith(arguments.toList()) diff --git a/compiler/testData/codegen/box/bridges/delegationComplexWithList.kt b/compiler/testData/codegen/box/bridges/delegationComplexWithList.kt index 15ff3e97ab6..8122ed82ae4 100644 --- a/compiler/testData/codegen/box/bridges/delegationComplexWithList.kt +++ b/compiler/testData/codegen/box/bridges/delegationComplexWithList.kt @@ -8,7 +8,7 @@ open class Content() { interface ContentBox : List -object Impl : ContentBox , AbstractList() { +object Impl : ContentBox, AbstractList() { override fun get(index: Int) = Content() override val size: Int diff --git a/compiler/testData/codegen/box/collections/removeClashWithGenerics.kt b/compiler/testData/codegen/box/collections/removeClashWithGenerics.kt new file mode 100644 index 00000000000..bb1b728c1bc --- /dev/null +++ b/compiler/testData/codegen/box/collections/removeClashWithGenerics.kt @@ -0,0 +1,62 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTUME + +// See also: KT-42083 + +var removed = "" + +class MyCharSequenceSet1 : Set { + override val size: Int get() = TODO() + override fun contains(element: CharSequence): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() + override fun iterator(): Iterator = TODO() + + fun remove(cs: Q): Boolean { + removed = cs.toString() + return false + } +} + +class MyCharSequenceSet2 : Set { + override val size: Int get() = TODO() + override fun contains(element: CharSequence): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() + override fun iterator(): Iterator = TODO() + + fun remove(cs: Q?): Boolean { + removed = cs.toString() + return false + } +} + +fun box(): String { + val s1 = MyCharSequenceSet1() + s1.remove("OK") + if (removed != "OK") throw AssertionError() + + try { + (s1 as java.util.Set).remove("OK") + throw AssertionError("(s1 as java.util.Set) should throw UnsupportedOperationException") + } catch (e: UnsupportedOperationException) { + } catch (e: Throwable) { + throw AssertionError("(s1 as java.util.Set) should throw UnsupportedOperationException") + } + + removed = "" + + val s2 = MyCharSequenceSet2() + s2.remove("OK") + if (removed != "OK") throw AssertionError() + + try { + (s2 as java.util.Set).remove("OK") + throw AssertionError("(s2 as java.util.Set) should throw UnsupportedOperationException") + } catch (e: UnsupportedOperationException) { + } catch (e: Throwable) { + throw AssertionError("(s2 as java.util.Set) should throw UnsupportedOperationException") + } + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/customListIterator.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/customListIterator.kt new file mode 100644 index 00000000000..1ec634b51d7 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/customListIterator.kt @@ -0,0 +1,33 @@ +// Ensure the proper collection stubs are added, in +// particular *not* when specialized implementations are provided. +class MyList : List { + val elements = ArrayList() + + class MyListIterator( + val list: ArrayList, + start: Int, + private val end: Int + ) : ListIterator { + var index = start + override fun hasNext() = index < end + override fun next() = list[index++] + override fun hasPrevious() = index > 0 + override fun nextIndex() = index + 1 + override fun previous() = list[--index] + override fun previousIndex() = index - 1 + } + + // List implementation: + override fun listIterator(index: Int) = MyListIterator(elements, index, size) + override fun listIterator() = listIterator(0) + override fun iterator() = listIterator() + + override val size get() = elements.size + override fun contains(element: E) = elements.contains(element) + override fun containsAll(elements: Collection) = this.elements.containsAll(elements) + override operator fun get(index: Int) = elements[index] + override fun indexOf(element: E): Int = elements.indexOf(element) + override fun lastIndexOf(element: E): Int = elements.lastIndexOf(element) + override fun isEmpty() = elements.isEmpty() + override fun subList(fromIndex: Int, toIndex: Int) = elements.subList(fromIndex, toIndex) +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/customListIterator.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/customListIterator.txt new file mode 100644 index 00000000000..7d1e4a27250 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/customListIterator.txt @@ -0,0 +1,57 @@ +@kotlin.Metadata +public final class MyList$MyListIterator { + // source: 'customListIterator.kt' + private final field end: int + private field index: int + private final @org.jetbrains.annotations.NotNull field list: java.util.ArrayList + public method (@org.jetbrains.annotations.NotNull p0: java.util.ArrayList, p1: int, p2: int): void + public method add(p0: java.lang.Object): void + public final method getIndex(): int + public final @org.jetbrains.annotations.NotNull method getList(): java.util.ArrayList + public method hasNext(): boolean + public method hasPrevious(): boolean + public method next(): java.lang.Object + public method nextIndex(): int + public method previous(): java.lang.Object + public method previousIndex(): int + public method remove(): void + public method set(p0: java.lang.Object): void + public final method setIndex(p0: int): void + public final inner class MyList$MyListIterator +} + +@kotlin.Metadata +public final class MyList { + // source: 'customListIterator.kt' + private final @org.jetbrains.annotations.NotNull field elements: java.util.ArrayList + 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(p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method get(p0: int): java.lang.Object + public final @org.jetbrains.annotations.NotNull method getElements(): java.util.ArrayList + public method getSize(): int + public method indexOf(p0: java.lang.Object): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): MyList$MyListIterator + public synthetic bridge method iterator(): java.util.Iterator + public method lastIndexOf(p0: java.lang.Object): int + public @org.jetbrains.annotations.NotNull method listIterator(): MyList$MyListIterator + public synthetic bridge method listIterator(): java.util.ListIterator + public @org.jetbrains.annotations.NotNull method listIterator(p0: int): MyList$MyListIterator + public synthetic bridge 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 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 @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[] + public final inner class MyList$MyListIterator +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/customMutableListIterator.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/customMutableListIterator.kt new file mode 100644 index 00000000000..534d8acd94e --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/customMutableListIterator.kt @@ -0,0 +1,49 @@ +// Ensure the proper collection stubs are added, in +// particular *not* when specialized implementations are provided. +class MyList : MutableList { + val elements = ArrayList() + + class MyListIterator( + val list: ArrayList, + start: Int, + private val end: Int + ) : MutableListIterator { + var index = start + override fun hasNext() = index < end + override fun next() = list[index++] + override fun hasPrevious() = index > 0 + override fun nextIndex() = index + 1 + override fun previous() = list[--index] + override fun previousIndex() = index - 1 + + override fun add(element: E): Unit = TODO() + override fun remove(): Unit = TODO() + override fun set(element: E): Unit = TODO() + } + + // List implementation: + override fun listIterator(index: Int) = MyListIterator(elements, index, size) + override fun listIterator() = listIterator(0) + override fun iterator() = listIterator() + + override val size get() = elements.size + override fun contains(element: E) = elements.contains(element) + override fun containsAll(elements: Collection) = this.elements.containsAll(elements) + override operator fun get(index: Int) = elements[index] + override fun indexOf(element: E): Int = elements.indexOf(element) + override fun lastIndexOf(element: E): Int = elements.lastIndexOf(element) + override fun isEmpty() = elements.isEmpty() + override fun subList(fromIndex: Int, toIndex: Int) = elements.subList(fromIndex, toIndex) + + // MutableList operations + override fun add(element: E): Boolean = TODO() + override fun add(index: Int, element: E): Unit = TODO() + override fun addAll(index: Int, elements: Collection): Boolean = TODO() + override fun addAll(elements: Collection): Boolean = TODO() + override fun clear(): Unit = TODO() + override fun remove(element: E): Boolean = TODO() + override fun removeAll(elements: Collection): Boolean = TODO() + override fun removeAt(index: Int): E = TODO() + override fun retainAll(elements: Collection): Boolean = TODO() + override fun set(index: Int, element: E): E = TODO() +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/customMutableListIterator.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/customMutableListIterator.txt new file mode 100644 index 00000000000..6841c8bbba3 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/customMutableListIterator.txt @@ -0,0 +1,58 @@ +@kotlin.Metadata +public final class MyList$MyListIterator { + // source: 'customMutableListIterator.kt' + private final field end: int + private field index: int + private final @org.jetbrains.annotations.NotNull field list: java.util.ArrayList + public method (@org.jetbrains.annotations.NotNull p0: java.util.ArrayList, p1: int, p2: int): void + public method add(p0: java.lang.Object): void + public final method getIndex(): int + public final @org.jetbrains.annotations.NotNull method getList(): java.util.ArrayList + public method hasNext(): boolean + public method hasPrevious(): boolean + public method next(): java.lang.Object + public method nextIndex(): int + public method previous(): java.lang.Object + public method previousIndex(): int + public method remove(): void + public method set(p0: java.lang.Object): void + public final method setIndex(p0: int): void + public final inner class MyList$MyListIterator +} + +@kotlin.Metadata +public final class MyList { + // source: 'customMutableListIterator.kt' + private final @org.jetbrains.annotations.NotNull field elements: java.util.ArrayList + public method (): void + public method add(p0: int, p1: java.lang.Object): void + public method add(p0: java.lang.Object): boolean + public method addAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method addAll(p0: int, @org.jetbrains.annotations.NotNull p1: java.util.Collection): boolean + public method clear(): void + public method contains(p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method get(p0: int): java.lang.Object + public final @org.jetbrains.annotations.NotNull method getElements(): java.util.ArrayList + public method getSize(): int + public method indexOf(p0: java.lang.Object): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): MyList$MyListIterator + public synthetic bridge method iterator(): java.util.Iterator + public method lastIndexOf(p0: java.lang.Object): int + public @org.jetbrains.annotations.NotNull method listIterator(): MyList$MyListIterator + public synthetic bridge method listIterator(): java.util.ListIterator + public @org.jetbrains.annotations.NotNull method listIterator(p0: int): MyList$MyListIterator + public synthetic bridge method listIterator(p0: int): java.util.ListIterator + public bridge final method remove(p0: int): java.lang.Object + public method remove(p0: java.lang.Object): boolean + public method removeAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method removeAt(p0: int): java.lang.Object + public method retainAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method set(p0: int, p1: java.lang.Object): java.lang.Object + public bridge final method size(): int + 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[] + public final inner class MyList$MyListIterator +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForCollection.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForCollection.kt new file mode 100644 index 00000000000..f824d971498 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForCollection.kt @@ -0,0 +1,15 @@ +// Ensure the proper collection stubs are added, in +// particular *not* when specialized implementations are provided. + +class MyCollection : Collection { + class MyIterator : Iterator { + override fun hasNext(): Boolean = TODO() + override fun next(): E = TODO() + } + + override val size: Int get() = TODO() + override fun contains(element: E): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() + override fun iterator() = MyIterator() +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForCollection.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForCollection.txt new file mode 100644 index 00000000000..0cac0443be9 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForCollection.txt @@ -0,0 +1,31 @@ +@kotlin.Metadata +public final class MyCollection$MyIterator { + // source: 'noStubsForCollection.kt' + public method (): void + public method hasNext(): boolean + public method next(): java.lang.Object + public method remove(): void + public final inner class MyCollection$MyIterator +} + +@kotlin.Metadata +public final class MyCollection { + // source: 'noStubsForCollection.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): MyCollection$MyIterator + public synthetic bridge method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] + public final inner class MyCollection$MyIterator +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMapImplementations.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMapImplementations.kt new file mode 100644 index 00000000000..da2d6d8421a --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMapImplementations.kt @@ -0,0 +1,28 @@ +// Ensure the proper collection stubs are added, in +// particular *not* when specialized implementations are provided. + +// IGNORE_BACKEND: JVM_IR +// TODO KT-42067 JVM_IR generates extra bridges: +// public bridge final method entrySet(): MyMap$MySet +// public bridge final method keySet(): MyMap$MySet +// public bridge final method values(): java.util.ArrayList +class MyMap : Map { + + class MySet : Set { + override fun contains(element: E): Boolean = TODO() + override fun iterator(): Iterator = TODO() + override fun isEmpty(): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override val size: Int get() = TODO() + } + + override val entries get() = MySet>() + override val keys get() = MySet() + override val size: Int get() = TODO() + override val values get() = ArrayList() + + override fun containsKey(key: K): Boolean = TODO() + override fun containsValue(value: V): Boolean = TODO() + override fun get(key: K): V = TODO() + override fun isEmpty(): Boolean = TODO() +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMapImplementations.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMapImplementations.txt new file mode 100644 index 00000000000..1a1461b94f8 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMapImplementations.txt @@ -0,0 +1,43 @@ +@kotlin.Metadata +public final class MyMap$MySet { + // source: 'noStubsForMapImplementations.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] + public final inner class MyMap$MySet +} + +@kotlin.Metadata +public final class MyMap { + // source: 'noStubsForMapImplementations.kt' + public method (): void + public method clear(): void + public method containsKey(p0: java.lang.Object): boolean + public method containsValue(p0: java.lang.Object): boolean + public bridge final method entrySet(): java.util.Set + public method get(p0: java.lang.Object): java.lang.Object + public @org.jetbrains.annotations.NotNull method getEntries(): MyMap$MySet + public @org.jetbrains.annotations.NotNull method getKeys(): MyMap$MySet + public method getSize(): int + public @org.jetbrains.annotations.NotNull method getValues(): java.util.ArrayList + public method isEmpty(): boolean + public bridge final method keySet(): java.util.Set + public method put(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object + public method putAll(p0: java.util.Map): void + public method remove(p0: java.lang.Object): java.lang.Object + public bridge final method size(): int + public bridge final method values(): java.util.Collection + public final inner class MyMap$MySet +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMutableSetIterators.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMutableSetIterators.kt new file mode 100644 index 00000000000..dbb0cd44937 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMutableSetIterators.kt @@ -0,0 +1,26 @@ +// Ensure the proper collection stubs are added, in +// particular *not* when specialized implementations are provided. +class MySet : MutableSet { + val elements: ArrayList = ArrayList() + + override val size: Int + get() = TODO() + + override fun add(element: E): Boolean = TODO() + override fun addAll(elements: Collection): Boolean = TODO() + override fun clear(): Unit = TODO() + override fun remove(element: E): Boolean = TODO() + override fun removeAll(elements: Collection): Boolean = TODO() + override fun retainAll(elements: Collection): Boolean = TODO() + override fun contains(element: E): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() + + class MySetIterator(elements: List) : MutableIterator { + override fun hasNext(): Boolean = TODO() + override fun next(): E = TODO() + override fun remove(): Unit = TODO() + } + + override fun iterator() = MySetIterator(elements) +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMutableSetIterators.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMutableSetIterators.txt new file mode 100644 index 00000000000..fb68325ae09 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMutableSetIterators.txt @@ -0,0 +1,33 @@ +@kotlin.Metadata +public final class MySet$MySetIterator { + // source: 'noStubsForMutableSetIterators.kt' + public method (@org.jetbrains.annotations.NotNull p0: java.util.List): void + public method hasNext(): boolean + public method next(): java.lang.Object + public method remove(): void + public final inner class MySet$MySetIterator +} + +@kotlin.Metadata +public final class MySet { + // source: 'noStubsForMutableSetIterators.kt' + private final @org.jetbrains.annotations.NotNull field elements: java.util.ArrayList + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method clear(): void + public method contains(p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public final @org.jetbrains.annotations.NotNull method getElements(): java.util.ArrayList + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): MySet$MySetIterator + public synthetic bridge method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public method retainAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] + public final inner class MySet$MySetIterator +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForSetIterators.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForSetIterators.kt new file mode 100644 index 00000000000..cdcd7156244 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForSetIterators.kt @@ -0,0 +1,18 @@ +// Ensure the proper collection stubs are added, in +// particular *not* when specialized implementations are provided. + +class MySet : Set { + val elements: ArrayList = ArrayList() + + override val size: Int get() = TODO() + override fun contains(element: E): Boolean = TODO() + override fun containsAll(elements: Collection): Boolean = TODO() + override fun isEmpty(): Boolean = TODO() + + class MySetIterator(elements: List) : Iterator { + override fun hasNext(): Boolean = TODO() + override fun next(): E = TODO() + } + + override fun iterator() = MySetIterator(elements) +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForSetIterators.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForSetIterators.txt new file mode 100644 index 00000000000..a6ac0f95db6 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForSetIterators.txt @@ -0,0 +1,33 @@ +@kotlin.Metadata +public final class MySet$MySetIterator { + // source: 'noStubsForSetIterators.kt' + public method (@org.jetbrains.annotations.NotNull p0: java.util.List): void + public method hasNext(): boolean + public method next(): java.lang.Object + public method remove(): void + public final inner class MySet$MySetIterator +} + +@kotlin.Metadata +public final class MySet { + // source: 'noStubsForSetIterators.kt' + private final @org.jetbrains.annotations.NotNull field elements: java.util.ArrayList + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public method contains(p0: java.lang.Object): boolean + public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean + public final @org.jetbrains.annotations.NotNull method getElements(): java.util.ArrayList + public method getSize(): int + public method isEmpty(): boolean + public @org.jetbrains.annotations.NotNull method iterator(): MySet$MySetIterator + public synthetic bridge method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] + public final inner class MySet$MySetIterator +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInIterable.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInIterable.kt new file mode 100644 index 00000000000..0ffb030e105 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInIterable.kt @@ -0,0 +1,8 @@ +class MyIterable : Iterable { + class MyIterator : Iterator { + override fun hasNext(): Boolean = TODO() + override fun next(): E = TODO() + } + + override fun iterator(): Iterator = TODO() +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInIterable.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInIterable.txt new file mode 100644 index 00000000000..53a72a067e7 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInIterable.txt @@ -0,0 +1,17 @@ +@kotlin.Metadata +public final class MyIterable$MyIterator { + // source: 'noStubsInIterable.kt' + public method (): void + public method hasNext(): boolean + public method next(): java.lang.Object + public method remove(): void + public final inner class MyIterable$MyIterator +} + +@kotlin.Metadata +public final class MyIterable { + // source: 'noStubsInIterable.kt' + public method (): void + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public final inner class MyIterable$MyIterator +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInMutableIterable.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInMutableIterable.kt new file mode 100644 index 00000000000..852827f0c1b --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInMutableIterable.kt @@ -0,0 +1,9 @@ +class MyIterable : MutableIterable { + class MyIterator : MutableIterator { + override fun hasNext(): Boolean = TODO() + override fun next(): E = TODO() + override fun remove() { TODO() } + } + + override fun iterator(): MutableIterator = TODO() +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInMutableIterable.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInMutableIterable.txt new file mode 100644 index 00000000000..948128ae587 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInMutableIterable.txt @@ -0,0 +1,17 @@ +@kotlin.Metadata +public final class MyIterable$MyIterator { + // source: 'noStubsInMutableIterable.kt' + public method (): void + public method hasNext(): boolean + public method next(): java.lang.Object + public method remove(): void + public final inner class MyIterable$MyIterator +} + +@kotlin.Metadata +public final class MyIterable { + // source: 'noStubsInMutableIterable.kt' + public method (): void + public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator + public final inner class MyIterable$MyIterator +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap.kt new file mode 100644 index 00000000000..cbf96e95f27 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap.kt @@ -0,0 +1,12 @@ +// See KT-42033 + +interface ObservableMap : Map + +abstract class ObservableMutableMap : ObservableMap { + fun put(key: K, value: V): V? = value + + fun remove(key: K): V? = null + + fun putAll(from: Map) { + } +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap.txt new file mode 100644 index 00000000000..e51d2ead58c --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap.txt @@ -0,0 +1,25 @@ +@kotlin.Metadata +public interface ObservableMap { + // source: 'observableMutableMap.kt' +} + +@kotlin.Metadata +public abstract class ObservableMutableMap { + // source: 'observableMutableMap.kt' + public method (): void + public method clear(): void + public abstract method containsKey(p0: java.lang.Object): boolean + public abstract method containsValue(p0: java.lang.Object): boolean + public bridge final method entrySet(): java.util.Set + public abstract method get(p0: java.lang.Object): java.lang.Object + public abstract method getEntries(): java.util.Set + public abstract method getKeys(): java.util.Set + public abstract method getSize(): int + public abstract method getValues(): java.util.Collection + public bridge final method keySet(): java.util.Set + public final @org.jetbrains.annotations.Nullable method put(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object + public final method putAll(@org.jetbrains.annotations.NotNull p0: java.util.Map): void + public final @org.jetbrains.annotations.Nullable method remove(p0: java.lang.Object): java.lang.Object + public bridge final method size(): int + public bridge final method values(): java.util.Collection +} diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap_ir.txt b/compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap_ir.txt new file mode 100644 index 00000000000..62e96db3e7b --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap_ir.txt @@ -0,0 +1,22 @@ +@kotlin.Metadata +public interface ObservableMap { + // source: 'observableMutableMap.kt' +} + +@kotlin.Metadata +public abstract class ObservableMutableMap { + // source: 'observableMutableMap.kt' + public method (): void + public method clear(): void + public bridge final method entrySet(): java.util.Set + public abstract method getEntries(): java.util.Set + public abstract method getKeys(): java.util.Set + public abstract method getSize(): int + public abstract method getValues(): java.util.Collection + public bridge final method keySet(): java.util.Set + public final @org.jetbrains.annotations.Nullable method put(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object + public final method putAll(@org.jetbrains.annotations.NotNull p0: java.util.Map): void + public final @org.jetbrains.annotations.Nullable method remove(p0: java.lang.Object): java.lang.Object + public bridge final method size(): int + public bridge final method values(): java.util.Collection +} diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections.kt b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections.kt new file mode 100644 index 00000000000..c286e55a3fa --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections.kt @@ -0,0 +1,14 @@ +abstract class ACA : Collection + +abstract class ACAN : Collection + +abstract class ACI : Collection + +abstract class ACIN : Collection + +abstract class ACS : Collection + +abstract class ACSN : Collection + +abstract class ACT : Collection + diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections.txt new file mode 100644 index 00000000000..298b34aab1a --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections.txt @@ -0,0 +1,133 @@ +@kotlin.Metadata +public abstract class ACA { + // source: 'abstractCollections.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACAN { + // source: 'abstractCollections.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACI { + // source: 'abstractCollections.kt' + public method (): void + public method add(p0: int): boolean + public synthetic method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: int): boolean + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACIN { + // source: 'abstractCollections.kt' + public method (): void + public method add(p0: java.lang.Integer): boolean + public synthetic method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: java.lang.Integer): boolean + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACS { + // source: 'abstractCollections.kt' + public method (): void + public synthetic method add(p0: java.lang.Object): boolean + public method add(p0: java.lang.String): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method contains(p0: java.lang.String): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACSN { + // source: 'abstractCollections.kt' + public method (): void + public synthetic method add(p0: java.lang.Object): boolean + public method add(p0: java.lang.String): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method contains(p0: java.lang.String): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACT { + // source: 'abstractCollections.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections_ir.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections_ir.txt new file mode 100644 index 00000000000..7cfbb465f59 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections_ir.txt @@ -0,0 +1,130 @@ +@kotlin.Metadata +public abstract class ACA { + // source: 'abstractCollections.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACAN { + // source: 'abstractCollections.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACI { + // source: 'abstractCollections.kt' + public method (): void + public method add(p0: int): boolean + public synthetic bridge method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: int): boolean + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACIN { + // source: 'abstractCollections.kt' + public method (): void + public method add(p0: java.lang.Integer): boolean + public synthetic bridge method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: java.lang.Integer): boolean + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACS { + // source: 'abstractCollections.kt' + public method (): void + public synthetic bridge method add(p0: java.lang.Object): boolean + public method add(p0: java.lang.String): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method contains(p0: java.lang.String): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACSN { + // source: 'abstractCollections.kt' + public method (): void + public synthetic bridge method add(p0: java.lang.Object): boolean + public method add(p0: java.lang.String): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method contains(p0: java.lang.String): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ACT { + // source: 'abstractCollections.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/abstractIterables.kt b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractIterables.kt new file mode 100644 index 00000000000..fa1e3dc85c9 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractIterables.kt @@ -0,0 +1,14 @@ +abstract class AIA : Iterable + +abstract class AIAN : Iterable + +abstract class AII : Iterable + +abstract class AIIN : Iterable + +abstract class AIS : Iterable + +abstract class AISN : Iterable + +abstract class AIT : Iterable + diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/abstractIterables.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractIterables.txt new file mode 100644 index 00000000000..670ec927c48 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractIterables.txt @@ -0,0 +1,48 @@ +@kotlin.Metadata +public abstract class AIA { + // source: 'abstractIterables.kt' + public method (): void + public method iterator(): java.util.Iterator +} + +@kotlin.Metadata +public abstract class AIAN { + // source: 'abstractIterables.kt' + public method (): void + public method iterator(): java.util.Iterator +} + +@kotlin.Metadata +public abstract class AII { + // source: 'abstractIterables.kt' + public method (): void + public method iterator(): java.util.Iterator +} + +@kotlin.Metadata +public abstract class AIIN { + // source: 'abstractIterables.kt' + public method (): void + public method iterator(): java.util.Iterator +} + +@kotlin.Metadata +public abstract class AIS { + // source: 'abstractIterables.kt' + public method (): void + public method iterator(): java.util.Iterator +} + +@kotlin.Metadata +public abstract class AISN { + // source: 'abstractIterables.kt' + public method (): void + public method iterator(): java.util.Iterator +} + +@kotlin.Metadata +public abstract class AIT { + // source: 'abstractIterables.kt' + public method (): void + public method iterator(): java.util.Iterator +} diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets.kt b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets.kt new file mode 100644 index 00000000000..0d6d84608ae --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets.kt @@ -0,0 +1,14 @@ +abstract class ASA : Set + +abstract class ASAN : Set + +abstract class ASI : Set + +abstract class ASIN : Set + +abstract class ASS : Set + +abstract class ASSN : Set + +abstract class AST : Set + diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets.txt new file mode 100644 index 00000000000..d996f8e29c1 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets.txt @@ -0,0 +1,133 @@ +@kotlin.Metadata +public abstract class ASA { + // source: 'abstractSets.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ASAN { + // source: 'abstractSets.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ASI { + // source: 'abstractSets.kt' + public method (): void + public method add(p0: int): boolean + public synthetic method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: int): boolean + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ASIN { + // source: 'abstractSets.kt' + public method (): void + public method add(p0: java.lang.Integer): boolean + public synthetic method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: java.lang.Integer): boolean + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ASS { + // source: 'abstractSets.kt' + public method (): void + public synthetic method add(p0: java.lang.Object): boolean + public method add(p0: java.lang.String): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method contains(p0: java.lang.String): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ASSN { + // source: 'abstractSets.kt' + public method (): void + public synthetic method add(p0: java.lang.Object): boolean + public method add(p0: java.lang.String): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method contains(p0: java.lang.String): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class AST { + // source: 'abstractSets.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets_ir.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets_ir.txt new file mode 100644 index 00000000000..a884b27fe10 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets_ir.txt @@ -0,0 +1,130 @@ +@kotlin.Metadata +public abstract class ASA { + // source: 'abstractSets.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ASAN { + // source: 'abstractSets.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ASI { + // source: 'abstractSets.kt' + public method (): void + public method add(p0: int): boolean + public synthetic bridge method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: int): boolean + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ASIN { + // source: 'abstractSets.kt' + public method (): void + public method add(p0: java.lang.Integer): boolean + public synthetic bridge method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method contains(p0: java.lang.Integer): boolean + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ASS { + // source: 'abstractSets.kt' + public method (): void + public synthetic bridge method add(p0: java.lang.Object): boolean + public method add(p0: java.lang.String): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method contains(p0: java.lang.String): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class ASSN { + // source: 'abstractSets.kt' + public method (): void + public synthetic bridge method add(p0: java.lang.Object): boolean + public method add(p0: java.lang.String): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public bridge final method contains(p0: java.lang.Object): boolean + public abstract method contains(p0: java.lang.String): boolean + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} + +@kotlin.Metadata +public abstract class AST { + // source: 'abstractSets.kt' + public method (): void + public method add(p0: java.lang.Object): boolean + public method addAll(p0: java.util.Collection): boolean + public method clear(): void + public abstract method getSize(): int + public method iterator(): java.util.Iterator + public method remove(p0: java.lang.Object): boolean + public method removeAll(p0: java.util.Collection): boolean + public method retainAll(p0: java.util.Collection): boolean + public bridge final method size(): int + public method toArray(): java.lang.Object[] + public method toArray(p0: java.lang.Object[]): java.lang.Object[] +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 4d14636ae71..1a1aa21a4ed 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -5058,6 +5058,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/collections/removeClashKotlin.kt"); } + @TestMetadata("removeClashWithGenerics.kt") + public void testRemoveClashWithGenerics() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeClashWithGenerics.kt"); + } + @TestMetadata("removeOverriddenInJava.kt") public void testRemoveOverriddenInJava() throws Exception { runTest("compiler/testData/codegen/box/collections/removeOverriddenInJava.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 73e763cfc2e..2a0d3138ed5 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -229,11 +229,56 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/collectionStubs"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("customListIterator.kt") + public void testCustomListIterator() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/customListIterator.kt"); + } + + @TestMetadata("customMutableListIterator.kt") + public void testCustomMutableListIterator() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/customMutableListIterator.kt"); + } + + @TestMetadata("noStubsForCollection.kt") + public void testNoStubsForCollection() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForCollection.kt"); + } + + @TestMetadata("noStubsForMapImplementations.kt") + public void testNoStubsForMapImplementations() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMapImplementations.kt"); + } + + @TestMetadata("noStubsForMutableSetIterators.kt") + public void testNoStubsForMutableSetIterators() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMutableSetIterators.kt"); + } + + @TestMetadata("noStubsForSetIterators.kt") + public void testNoStubsForSetIterators() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForSetIterators.kt"); + } + + @TestMetadata("noStubsInIterable.kt") + public void testNoStubsInIterable() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInIterable.kt"); + } + @TestMetadata("noStubsInJavaSuperClass.kt") public void testNoStubsInJavaSuperClass() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInJavaSuperClass.kt"); } + @TestMetadata("noStubsInMutableIterable.kt") + public void testNoStubsInMutableIterable() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInMutableIterable.kt"); + } + + @TestMetadata("observableMutableMap.kt") + public void testObservableMutableMap() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap.kt"); + } + @TestMetadata("stubsFromSuperclass.kt") public void testStubsFromSuperclass() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/stubsFromSuperclass.kt"); @@ -794,6 +839,16 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } + @TestMetadata("abstractCollections.kt") + public void testAbstractCollections() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections.kt"); + } + + @TestMetadata("abstractIterables.kt") + public void testAbstractIterables() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/abstractIterables.kt"); + } + @TestMetadata("abstractLists.kt") public void testAbstractLists() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/abstractLists.kt"); @@ -809,6 +864,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/abstractMutableLists.kt"); } + @TestMetadata("abstractSets.kt") + public void testAbstractSets() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets.kt"); + } + public void testAllFilesPresentInSpecialBridges() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/specialBridges"), Pattern.compile("^(.+)\\.kt$"), null, true); } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 0dc14089e56..7960aa17362 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -5058,6 +5058,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/collections/removeClashKotlin.kt"); } + @TestMetadata("removeClashWithGenerics.kt") + public void testRemoveClashWithGenerics() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeClashWithGenerics.kt"); + } + @TestMetadata("removeOverriddenInJava.kt") public void testRemoveOverriddenInJava() throws Exception { runTest("compiler/testData/codegen/box/collections/removeOverriddenInJava.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 7338e0f5739..2d975618681 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -5028,6 +5028,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/collections/removeClashKotlin.kt"); } + @TestMetadata("removeClashWithGenerics.kt") + public void testRemoveClashWithGenerics() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeClashWithGenerics.kt"); + } + @TestMetadata("removeOverriddenInJava.kt") public void testRemoveOverriddenInJava() throws Exception { runTest("compiler/testData/codegen/box/collections/removeOverriddenInJava.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index a0646296fd7..b3f2f96aaed 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -229,11 +229,56 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/collectionStubs"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("customListIterator.kt") + public void testCustomListIterator() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/customListIterator.kt"); + } + + @TestMetadata("customMutableListIterator.kt") + public void testCustomMutableListIterator() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/customMutableListIterator.kt"); + } + + @TestMetadata("noStubsForCollection.kt") + public void testNoStubsForCollection() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForCollection.kt"); + } + + @TestMetadata("noStubsForMapImplementations.kt") + public void testNoStubsForMapImplementations() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMapImplementations.kt"); + } + + @TestMetadata("noStubsForMutableSetIterators.kt") + public void testNoStubsForMutableSetIterators() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForMutableSetIterators.kt"); + } + + @TestMetadata("noStubsForSetIterators.kt") + public void testNoStubsForSetIterators() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsForSetIterators.kt"); + } + + @TestMetadata("noStubsInIterable.kt") + public void testNoStubsInIterable() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInIterable.kt"); + } + @TestMetadata("noStubsInJavaSuperClass.kt") public void testNoStubsInJavaSuperClass() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInJavaSuperClass.kt"); } + @TestMetadata("noStubsInMutableIterable.kt") + public void testNoStubsInMutableIterable() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/noStubsInMutableIterable.kt"); + } + + @TestMetadata("observableMutableMap.kt") + public void testObservableMutableMap() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/observableMutableMap.kt"); + } + @TestMetadata("stubsFromSuperclass.kt") public void testStubsFromSuperclass() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/collectionStubs/stubsFromSuperclass.kt"); @@ -764,6 +809,16 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); } + @TestMetadata("abstractCollections.kt") + public void testAbstractCollections() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/abstractCollections.kt"); + } + + @TestMetadata("abstractIterables.kt") + public void testAbstractIterables() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/abstractIterables.kt"); + } + @TestMetadata("abstractLists.kt") public void testAbstractLists() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/abstractLists.kt"); @@ -779,6 +834,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/specialBridges/abstractMutableLists.kt"); } + @TestMetadata("abstractSets.kt") + public void testAbstractSets() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/abstractSets.kt"); + } + public void testAllFilesPresentInSpecialBridges() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/specialBridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); }