K2: resolve remove(Int) clash in JavaOverrideChecker

In Kotlin subclasses of `MutableCollection<Int>`, the method
`remove(Int)` has its argument boxed, so that it wouldn't clash with the
method from `java.util.List`. So `JavaOverrideChecker` should understand
that a Java method `boolean remove(java.lang.Integer)` overrides it,
otherwise platform declaration clash was reported.

The code is adapted from `forceSingleValueParameterBoxing` in K1's
`methodSignatureMapping.kt`.

The test has been moved and adapted from diagnostic to codegen box
tests, to check correct backend execution + runtime.

 #KT-62316 Fixed
This commit is contained in:
Alexander Udalov
2023-10-06 12:33:55 +02:00
committed by Space Team
parent 8e023edc4f
commit 2788dcb5ff
17 changed files with 203 additions and 268 deletions
@@ -21225,12 +21225,6 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAt.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAtInt.kt");
}
@Test
@TestMetadata("sizeFromKotlinOverriddenInJava.kt")
public void testSizeFromKotlinOverriddenInJava() throws Exception {
@@ -21225,12 +21225,6 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAt.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAtInt.kt");
}
@Test
@TestMetadata("sizeFromKotlinOverriddenInJava.kt")
public void testSizeFromKotlinOverriddenInJava() throws Exception {
@@ -21225,12 +21225,6 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAt.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAtInt.kt");
}
@Test
@TestMetadata("sizeFromKotlinOverriddenInJava.kt")
public void testSizeFromKotlinOverriddenInJava() throws Exception {
@@ -21231,12 +21231,6 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAt.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAtInt.kt");
}
@Test
@TestMetadata("sizeFromKotlinOverriddenInJava.kt")
public void testSizeFromKotlinOverriddenInJava() throws Exception {
@@ -7661,6 +7661,18 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/collections/removeAtInt.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava.kt")
public void testRemoveAtIntOverrideInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava2.kt")
public void testRemoveAtIntOverrideInJava2() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava2.kt");
}
@Test
@TestMetadata("removeClash.kt")
public void testRemoveClash() throws Exception {
@@ -7661,6 +7661,18 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/collections/removeAtInt.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava.kt")
public void testRemoveAtIntOverrideInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava2.kt")
public void testRemoveAtIntOverrideInJava2() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava2.kt");
}
@Test
@TestMetadata("removeClash.kt")
public void testRemoveClash() throws Exception {
@@ -7661,6 +7661,18 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/collections/removeAtInt.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava.kt")
public void testRemoveAtIntOverrideInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava2.kt")
public void testRemoveAtIntOverrideInJava2() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava2.kt");
}
@Test
@TestMetadata("removeClash.kt")
public void testRemoveClash() throws Exception {
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.java.scopes
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.containingClassLookupTag
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.utils.isStatic
import org.jetbrains.kotlin.fir.declarations.utils.modality
@@ -76,18 +77,17 @@ class JavaOverrideChecker internal constructor(
private fun isEqualTypes(
candidateTypeRef: FirTypeRef,
baseTypeRef: FirTypeRef,
substitutor: ConeSubstitutor
substitutor: ConeSubstitutor,
forceBoxCandidateType: Boolean,
forceBoxBaseType: Boolean,
): Boolean {
val candidateType = candidateTypeRef.toConeKotlinTypeProbablyFlexible(session, javaTypeParameterStack)
val baseType = baseTypeRef.toConeKotlinTypeProbablyFlexible(session, javaTypeParameterStack)
if (candidateType.isPrimitiveInJava(isReturnType = false) != baseType.isPrimitiveInJava(isReturnType = false)) return false
val candidateTypeIsPrimitive = !forceBoxCandidateType && candidateType.isPrimitiveInJava(isReturnType = false)
val baseTypeIsPrimitive = !forceBoxBaseType && baseType.isPrimitiveInJava(isReturnType = false)
return isEqualTypes(
candidateType,
baseType,
substitutor
)
return candidateTypeIsPrimitive == baseTypeIsPrimitive && isEqualTypes(candidateType, baseType, substitutor)
}
// In most cases checking erasure of value parameters should be enough, but in some cases there might be semi-valid Java hierarchies
@@ -241,8 +241,11 @@ class JavaOverrideChecker internal constructor(
if (overrideCandidate.valueParameters.size != baseParameterTypes.size) return false
val substitutor = buildTypeParametersSubstitutorIfCompatible(overrideCandidate, baseDeclaration)
val forceBoxOverrideParameterType = forceSingleValueParameterBoxing(overrideCandidate)
val forceBoxBaseParameterType = forceSingleValueParameterBoxing(baseDeclaration)
if (!overrideCandidate.valueParameters.zip(baseParameterTypes).all { (paramFromJava, baseType) ->
isEqualTypes(paramFromJava.returnTypeRef, baseType, substitutor)
isEqualTypes(paramFromJava.returnTypeRef, baseType, substitutor, forceBoxOverrideParameterType, forceBoxBaseParameterType)
}) {
return false
}
@@ -266,7 +269,10 @@ class JavaOverrideChecker internal constructor(
return overrideCandidate.valueParameters.isEmpty()
} else {
if (overrideCandidate.valueParameters.size != 1) return false
return isEqualTypes(receiverTypeRef, overrideCandidate.valueParameters.single().returnTypeRef, ConeSubstitutor.Empty)
return isEqualTypes(
receiverTypeRef, overrideCandidate.valueParameters.single().returnTypeRef, ConeSubstitutor.Empty,
forceBoxCandidateType = false, forceBoxBaseType = false
)
}
}
is FirProperty -> {
@@ -274,11 +280,40 @@ class JavaOverrideChecker internal constructor(
return when {
receiverTypeRef == null -> overrideReceiverTypeRef == null
overrideReceiverTypeRef == null -> false
else -> isEqualTypes(receiverTypeRef, overrideReceiverTypeRef, ConeSubstitutor.Empty)
else -> isEqualTypes(
receiverTypeRef, overrideReceiverTypeRef, ConeSubstitutor.Empty,
forceBoxCandidateType = false, forceBoxBaseType = false
)
}
}
else -> false
}
}
// Boxing is only necessary for 'remove(E): Boolean' of a MutableCollection<Int> implementation.
// Otherwise this method might clash with 'remove(I): E' defined in the java.util.List JDK interface (mapped to kotlin 'removeAt').
// As in the K1 implementation in `methodSignatureMapping.kt`, we're checking if the method has `MutableCollection.remove`
// in its overridden symbols.
private fun forceSingleValueParameterBoxing(function: FirSimpleFunction): Boolean {
if (function.name.asString() != "remove" || function.receiverParameter != null || function.contextReceivers.isNotEmpty())
return false
val parameter = function.valueParameters.singleOrNull() ?: return false
val parameterConeType = parameter.returnTypeRef.toConeKotlinTypeProbablyFlexible(session, javaTypeParameterStack)
if (!parameterConeType.fullyExpandedType(session).lowerBoundIfFlexible().isInt) return false
var overridesMutableCollectionRemove = false
baseScopes?.processOverriddenFunctions(function.symbol) {
if (it.fir.containingClassLookupTag() == StandardClassIds.MutableCollection.toLookupTag()) {
overridesMutableCollectionRemove = true
ProcessorAction.STOP
} else {
ProcessorAction.NEXT
}
}
return overridesMutableCollectionRemove
}
}
@@ -1,9 +1,9 @@
// FIR_IDENTICAL
// JAVAC_EXPECTED_FILE
// TARGET_BACKEND: JVM
// FILE: A.java
abstract public class A extends B {
public Integer removeAt(int x) { }
public boolean remove(Integer x) { }
public Integer removeAt(int x) { return 0; }
public boolean remove(Integer x) { return false; }
}
// FILE: main.kt
@@ -17,17 +17,43 @@ abstract class B : MutableList<Int>, AbstractList<Int>() {
abstract class D : AbstractList<Int>() {
// removeAt() doesn't exist in java/util/AbstractList, it's a
// fake override of the method from kotlin/collections/MutableList
override fun removeAt(index: Int): Int = null!!
override fun removeAt(index: Int): Int = 0
// AbstractList::remove() should return Int here. No fake overrides created.
// This may be a bug because the old compiler doesn't report a diagnostic here.
override fun remove(element: Int): Boolean = null!!
override fun remove(element: Int): Boolean = false
}
fun main(a: A, b: B, c: ArrayList<Int>) {
fun testABD(a: A, b: B, d: D) {
a.remove(1)
a.removeAt(0)
b.remove(1)
b.removeAt(0)
d.remove(1)
d.removeAt(0)
}
fun testArrayList(c: ArrayList<Int>) {
c.remove(1)
c.removeAt(0)
}
class AImpl : A() {
override fun get(index: Int): Int = 0
override val size: Int get() = 0
}
class DImpl : D() {
override fun get(index: Int): Int = 0
override val size: Int get() = 0
}
fun box(): String {
testABD(AImpl(), AImpl(), DImpl())
val c = ArrayList<Int>()
c.add(1)
c.add(1)
testArrayList(c)
return "OK"
}
@@ -0,0 +1,43 @@
// TARGET_BACKEND: JVM
// IGNORE_LIGHT_ANALYSIS
// FILE: IntOpenHashSet.java
import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
public class IntOpenHashSet extends AbstractIntSet {
@Override
public boolean remove(final int k) { return false; }
@Override
public void clear() {}
@Override
public int size() { return 0; }
@Override
public Iterator<Integer> iterator() { return null; }
}
abstract class AbstractIntSet extends AbstractIntCollection implements IntSet {
@Override
public boolean remove(int k) { return false; }
}
abstract class AbstractIntCollection extends AbstractCollection<Integer> implements IntCollection {}
interface IntCollection extends Collection<Integer> {}
interface IntSet extends IntCollection, Set<Integer> {
boolean remove(int k);
}
// FILE: box.kt
fun box(): String {
val s = IntOpenHashSet()
s.remove(0)
return "OK"
}
@@ -1,111 +0,0 @@
package
public fun main(/*0*/ a: A, /*1*/ b: B, /*2*/ c: java.util.ArrayList<kotlin.Int>): kotlin.Unit
public abstract class A : B {
public constructor A()
protected/*protected and package*/ final override /*1*/ /*fake_override*/ var modCount: kotlin.Int
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
public open override /*1*/ /*fake_override*/ fun add(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun add(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun addAll(/*0*/ index: kotlin.Int, /*1*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun addAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun contains(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun indexOf(/*0*/ element: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun iterator(): kotlin.collections.MutableIterator<kotlin.Int>
public open override /*1*/ /*fake_override*/ fun lastIndexOf(/*0*/ element: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun listIterator(): kotlin.collections.MutableListIterator<kotlin.Int>
public open override /*1*/ /*fake_override*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.collections.MutableListIterator<kotlin.Int>
invisible_fake open override /*1*/ /*fake_override*/ fun outOfBoundsMsg(/*0*/ p0: kotlin.Int): kotlin.String!
invisible_fake open override /*1*/ /*fake_override*/ fun rangeCheckForAdd(/*0*/ p0: kotlin.Int): kotlin.Unit
public open override /*1*/ fun remove(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun removeAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*1*/ fun removeAt(/*0*/ index: kotlin.Int): kotlin.Int
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun removeRange(/*0*/ p0: kotlin.Int, /*1*/ p1: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun retainAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun set(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.collections.MutableList<kotlin.Int>
public open override /*1*/ /*fake_override*/ fun toArray(): kotlin.Array<(out) kotlin.Any!>!
public open override /*1*/ /*fake_override*/ fun </*0*/ T : kotlin.Any!> toArray(/*0*/ p0: kotlin.Array<(out) T!>!): kotlin.Array<(out) T!>!
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
invisible_fake const final override /*1*/ /*fake_override*/ val MAX_ARRAY_SIZE: kotlin.Int = 2147483639
invisible_fake open override /*1*/ /*fake_override*/ fun </*0*/ T : kotlin.Any!> finishToArray(/*0*/ p0: kotlin.Array<(out) T!>!, /*1*/ p1: kotlin.collections.(Mutable)Iterator<*>!): kotlin.Array<(out) T!>!
invisible_fake open override /*1*/ /*fake_override*/ fun hugeCapacity(/*0*/ p0: kotlin.Int): kotlin.Int
}
public abstract class B : kotlin.collections.MutableList<kotlin.Int>, java.util.AbstractList<kotlin.Int> {
public constructor B()
protected/*protected and package*/ final override /*1*/ /*fake_override*/ var modCount: kotlin.Int
public abstract override /*2*/ /*fake_override*/ val size: kotlin.Int
public open override /*2*/ /*fake_override*/ fun add(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun add(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int): kotlin.Unit
public open override /*2*/ /*fake_override*/ fun addAll(/*0*/ index: kotlin.Int, /*1*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun addAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun clear(): kotlin.Unit
public open override /*2*/ /*fake_override*/ fun contains(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract override /*2*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Int
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun indexOf(/*0*/ element: kotlin.Int): kotlin.Int
public open override /*2*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun iterator(): kotlin.collections.MutableIterator<kotlin.Int>
public open override /*2*/ /*fake_override*/ fun lastIndexOf(/*0*/ element: kotlin.Int): kotlin.Int
public open override /*2*/ /*fake_override*/ fun listIterator(): kotlin.collections.MutableListIterator<kotlin.Int>
public open override /*2*/ /*fake_override*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.collections.MutableListIterator<kotlin.Int>
invisible_fake open override /*1*/ /*fake_override*/ fun outOfBoundsMsg(/*0*/ p0: kotlin.Int): kotlin.String!
invisible_fake open override /*1*/ /*fake_override*/ fun rangeCheckForAdd(/*0*/ p0: kotlin.Int): kotlin.Unit
public open override /*2*/ fun remove(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun removeAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*2*/ fun removeAt(/*0*/ index: kotlin.Int): kotlin.Int
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun removeRange(/*0*/ p0: kotlin.Int, /*1*/ p1: kotlin.Int): kotlin.Unit
public open override /*2*/ /*fake_override*/ fun retainAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun set(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int): kotlin.Int
public open override /*2*/ /*fake_override*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.collections.MutableList<kotlin.Int>
public open override /*1*/ /*fake_override*/ fun toArray(): kotlin.Array<(out) kotlin.Any!>!
public open override /*1*/ /*fake_override*/ fun </*0*/ T : kotlin.Any!> toArray(/*0*/ p0: kotlin.Array<(out) T!>!): kotlin.Array<(out) T!>!
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
}
public abstract class D : java.util.AbstractList<kotlin.Int> {
public constructor D()
protected/*protected and package*/ final override /*1*/ /*fake_override*/ var modCount: kotlin.Int
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
public open override /*1*/ /*fake_override*/ fun add(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun add(/*0*/ element: kotlin.Int!): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun addAll(/*0*/ index: kotlin.Int, /*1*/ elements: kotlin.collections.Collection<kotlin.Int!>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun addAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int!>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun contains(/*0*/ element: kotlin.Int!): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int!>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Int!
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun indexOf(/*0*/ element: kotlin.Int!): kotlin.Int
public open override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun iterator(): kotlin.collections.MutableIterator<kotlin.Int!>
public open override /*1*/ /*fake_override*/ fun lastIndexOf(/*0*/ element: kotlin.Int!): kotlin.Int
public open override /*1*/ /*fake_override*/ fun listIterator(): kotlin.collections.MutableListIterator<kotlin.Int!>
public open override /*1*/ /*fake_override*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.collections.MutableListIterator<kotlin.Int!>
invisible_fake open override /*1*/ /*fake_override*/ fun outOfBoundsMsg(/*0*/ p0: kotlin.Int): kotlin.String!
invisible_fake open override /*1*/ /*fake_override*/ fun rangeCheckForAdd(/*0*/ p0: kotlin.Int): kotlin.Unit
public open override /*1*/ fun remove(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun removeAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int!>): kotlin.Boolean
public open override /*1*/ fun removeAt(/*0*/ index: kotlin.Int): kotlin.Int
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun removeRange(/*0*/ p0: kotlin.Int, /*1*/ p1: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun retainAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int!>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun set(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int!): kotlin.Int!
public open override /*1*/ /*fake_override*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.collections.MutableList<kotlin.Int!>
public open override /*1*/ /*fake_override*/ fun toArray(): kotlin.Array<(out) kotlin.Any!>!
public open override /*1*/ /*fake_override*/ fun </*0*/ T : kotlin.Any!> toArray(/*0*/ p0: kotlin.Array<(out) T!>!): kotlin.Array<(out) T!>!
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,110 +0,0 @@
package
public fun main(/*0*/ a: A, /*1*/ b: B, /*2*/ c: java.util.ArrayList<kotlin.Int>): kotlin.Unit
public abstract class A : B {
public constructor A()
protected/*protected and package*/ final override /*1*/ /*fake_override*/ var modCount: kotlin.Int
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
public open override /*1*/ /*fake_override*/ fun add(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun add(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun addAll(/*0*/ index: kotlin.Int, /*1*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun addAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun contains(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun indexOf(/*0*/ element: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun iterator(): kotlin.collections.MutableIterator<kotlin.Int>
public open override /*1*/ /*fake_override*/ fun lastIndexOf(/*0*/ element: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun listIterator(): kotlin.collections.MutableListIterator<kotlin.Int>
public open override /*1*/ /*fake_override*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.collections.MutableListIterator<kotlin.Int>
invisible_fake open override /*1*/ /*fake_override*/ fun outOfBoundsMsg(/*0*/ index: kotlin.Int): kotlin.String!
invisible_fake open override /*1*/ /*fake_override*/ fun rangeCheckForAdd(/*0*/ index: kotlin.Int): kotlin.Unit
public open override /*1*/ fun remove(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun removeAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*1*/ fun removeAt(/*0*/ index: kotlin.Int): kotlin.Int
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun removeRange(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun retainAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun set(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.collections.MutableList<kotlin.Int>
public open override /*1*/ /*fake_override*/ fun toArray(): kotlin.Array<(out) kotlin.Any!>!
public open override /*1*/ /*fake_override*/ fun </*0*/ T : kotlin.Any!> toArray(/*0*/ a: kotlin.Array<(out) T!>!): kotlin.Array<(out) T!>!
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
invisible_fake const final override /*1*/ /*fake_override*/ val MAX_ARRAY_SIZE: kotlin.Int = 2147483639
invisible_fake open override /*1*/ /*fake_override*/ fun </*0*/ T : kotlin.Any!> finishToArray(/*0*/ r: kotlin.Array<(out) T!>!, /*1*/ it: kotlin.collections.(Mutable)Iterator<*>!): kotlin.Array<(out) T!>!
invisible_fake open override /*1*/ /*fake_override*/ fun hugeCapacity(/*0*/ minCapacity: kotlin.Int): kotlin.Int
}
public abstract class B : kotlin.collections.MutableList<kotlin.Int>, java.util.AbstractList<kotlin.Int> {
public constructor B()
protected/*protected and package*/ final override /*1*/ /*fake_override*/ var modCount: kotlin.Int
public abstract override /*2*/ /*fake_override*/ val size: kotlin.Int
public open override /*2*/ /*fake_override*/ fun add(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun add(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int): kotlin.Unit
public open override /*2*/ /*fake_override*/ fun addAll(/*0*/ index: kotlin.Int, /*1*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun addAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun clear(): kotlin.Unit
public open override /*2*/ /*fake_override*/ fun contains(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract override /*2*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Int
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun indexOf(/*0*/ element: kotlin.Int): kotlin.Int
public open override /*2*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun iterator(): kotlin.collections.MutableIterator<kotlin.Int>
public open override /*2*/ /*fake_override*/ fun lastIndexOf(/*0*/ element: kotlin.Int): kotlin.Int
public open override /*2*/ /*fake_override*/ fun listIterator(): kotlin.collections.MutableListIterator<kotlin.Int>
public open override /*2*/ /*fake_override*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.collections.MutableListIterator<kotlin.Int>
invisible_fake open override /*1*/ /*fake_override*/ fun outOfBoundsMsg(/*0*/ index: kotlin.Int): kotlin.String!
invisible_fake open override /*1*/ /*fake_override*/ fun rangeCheckForAdd(/*0*/ index: kotlin.Int): kotlin.Unit
public open override /*2*/ fun remove(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun removeAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*2*/ fun removeAt(/*0*/ index: kotlin.Int): kotlin.Int
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun removeRange(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.Unit
public open override /*2*/ /*fake_override*/ fun retainAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int>): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun set(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int): kotlin.Int
public open override /*2*/ /*fake_override*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.collections.MutableList<kotlin.Int>
public open override /*1*/ /*fake_override*/ fun toArray(): kotlin.Array<(out) kotlin.Any!>!
public open override /*1*/ /*fake_override*/ fun </*0*/ T : kotlin.Any!> toArray(/*0*/ a: kotlin.Array<(out) T!>!): kotlin.Array<(out) T!>!
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
}
public abstract class D : java.util.AbstractList<kotlin.Int> {
public constructor D()
protected/*protected and package*/ final override /*1*/ /*fake_override*/ var modCount: kotlin.Int
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
public open override /*1*/ /*fake_override*/ fun add(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun add(/*0*/ element: kotlin.Int!): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun addAll(/*0*/ index: kotlin.Int, /*1*/ elements: kotlin.collections.Collection<kotlin.Int!>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun addAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int!>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun contains(/*0*/ element: kotlin.Int!): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int!>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Int!
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun indexOf(/*0*/ element: kotlin.Int!): kotlin.Int
public open override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun iterator(): kotlin.collections.MutableIterator<kotlin.Int!>
public open override /*1*/ /*fake_override*/ fun lastIndexOf(/*0*/ element: kotlin.Int!): kotlin.Int
public open override /*1*/ /*fake_override*/ fun listIterator(): kotlin.collections.MutableListIterator<kotlin.Int!>
public open override /*1*/ /*fake_override*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.collections.MutableListIterator<kotlin.Int!>
invisible_fake open override /*1*/ /*fake_override*/ fun outOfBoundsMsg(/*0*/ index: kotlin.Int): kotlin.String!
invisible_fake open override /*1*/ /*fake_override*/ fun rangeCheckForAdd(/*0*/ index: kotlin.Int): kotlin.Unit
public open override /*1*/ fun remove(/*0*/ element: kotlin.Int): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun removeAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int!>): kotlin.Boolean
public open override /*1*/ fun removeAt(/*0*/ index: kotlin.Int): kotlin.Int
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun removeRange(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun retainAll(/*0*/ elements: kotlin.collections.Collection<kotlin.Int!>): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun set(/*0*/ index: kotlin.Int, /*1*/ element: kotlin.Int!): kotlin.Int!
public open override /*1*/ /*fake_override*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.collections.MutableList<kotlin.Int!>
public open override /*1*/ /*fake_override*/ fun toArray(): kotlin.Array<(out) kotlin.Any!>!
public open override /*1*/ /*fake_override*/ fun </*0*/ T : kotlin.Any!> toArray(/*0*/ a: kotlin.Array<(out) T!>!): kotlin.Array<(out) T!>!
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -21231,12 +21231,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAt.kt");
}
@Test
@TestMetadata("removeAtInt.kt")
public void testRemoveAtInt() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAtInt.kt");
}
@Test
@TestMetadata("sizeFromKotlinOverriddenInJava.kt")
public void testSizeFromKotlinOverriddenInJava() throws Exception {
@@ -7427,6 +7427,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/collections/removeAtInt.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava.kt")
public void testRemoveAtIntOverrideInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava2.kt")
public void testRemoveAtIntOverrideInJava2() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava2.kt");
}
@Test
@TestMetadata("removeClash.kt")
public void testRemoveClash() throws Exception {
@@ -7661,6 +7661,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/collections/removeAtInt.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava.kt")
public void testRemoveAtIntOverrideInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava2.kt")
public void testRemoveAtIntOverrideInJava2() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava2.kt");
}
@Test
@TestMetadata("removeClash.kt")
public void testRemoveClash() throws Exception {
@@ -7661,6 +7661,18 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/collections/removeAtInt.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava.kt")
public void testRemoveAtIntOverrideInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt");
}
@Test
@TestMetadata("removeAtIntOverrideInJava2.kt")
public void testRemoveAtIntOverrideInJava2() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava2.kt");
}
@Test
@TestMetadata("removeClash.kt")
public void testRemoveClash() throws Exception {
@@ -6678,6 +6678,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/collections/removeAtInt.kt");
}
@TestMetadata("removeAtIntOverrideInJava.kt")
public void testRemoveAtIntOverrideInJava() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt");
}
@TestMetadata("removeAtIntOverrideInJava2.kt")
public void testRemoveAtIntOverrideInJava2() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeAtIntOverrideInJava2.kt");
}
@TestMetadata("removeClash.kt")
public void testRemoveClash() throws Exception {
runTest("compiler/testData/codegen/box/collections/removeClash.kt");