diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index d784db5b4a1..eea61ad2487 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -22859,6 +22859,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/notNullAnnotated.kt"); } + @Test + @TestMetadata("removeAt.kt") + public void testRemoveAt() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt"); + } + @Test @TestMetadata("specializedMap.kt") public void testSpecializedMap() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java index 84a325a16aa..dcb2858bb84 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java @@ -8242,6 +8242,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt"); } + @Test + @TestMetadata("removeAtInJava.kt") + public void testRemoveAtInJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt"); + } + @Test @TestMetadata("removeAtInt.kt") public void testRemoveAtInt() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index 9a2fdeccc38..7fcb9f4ee52 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -22859,6 +22859,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/notNullAnnotated.kt"); } + @Test + @TestMetadata("removeAt.kt") + public void testRemoveAt() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt"); + } + @Test @TestMetadata("specializedMap.kt") public void testSpecializedMap() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java index 54305d16143..244d473286a 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java @@ -8242,6 +8242,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt"); } + @Test + @TestMetadata("removeAtInJava.kt") + public void testRemoveAtInJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt"); + } + @Test @TestMetadata("removeAtInt.kt") public void testRemoveAtInt() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index 36316eb7264..4a8f2f8ecf2 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -22853,6 +22853,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/notNullAnnotated.kt"); } + @Test + @TestMetadata("removeAt.kt") + public void testRemoveAt() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt"); + } + @Test @TestMetadata("specializedMap.kt") public void testSpecializedMap() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index f9eac887122..62f14214040 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -22859,6 +22859,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/notNullAnnotated.kt"); } + @Test + @TestMetadata("removeAt.kt") + public void testRemoveAt() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt"); + } + @Test @TestMetadata("specializedMap.kt") public void testSpecializedMap() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index f6630bdf516..2972483b292 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -8243,6 +8243,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt"); } + @Test + @TestMetadata("removeAtInJava.kt") + public void testRemoveAtInJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt"); + } + @Test @TestMetadata("removeAtInt.kt") public void testRemoveAtInt() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java index 39fddfc8ebe..b58cb02a96e 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java @@ -8243,6 +8243,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt"); } + @Test + @TestMetadata("removeAtInJava.kt") + public void testRemoveAtInJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt"); + } + @Test @TestMetadata("removeAtInt.kt") public void testRemoveAtInt() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 15cfb347873..10539163fe2 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -8243,6 +8243,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt"); } + @Test + @TestMetadata("removeAtInJava.kt") + public void testRemoveAtInJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt"); + } + @Test @TestMetadata("removeAtInt.kt") public void testRemoveAtInt() throws Exception { diff --git a/compiler/testData/codegen/box/collections/removeAtInJava.kt b/compiler/testData/codegen/box/collections/removeAtInJava.kt new file mode 100644 index 00000000000..b2b0a3dc132 --- /dev/null +++ b/compiler/testData/codegen/box/collections/removeAtInJava.kt @@ -0,0 +1,49 @@ +// TARGET_BACKEND: JVM_IR +// IGNORE_BACKEND_K2: JVM_IR +// WITH_STDLIB +// ISSUE: KT-65410 + +// FILE: Java1.java +import kotlin.collections.AbstractMutableList; + +public class Java1 extends AbstractMutableList { + int size = 0; + + @Override + public int getSize() { + return size; + } + + @Override + public void add(int i, Integer integer) { + size++; + } + + @Override + public Integer removeAt(int i) { + size--; + return null; + } + + @Override + public Integer get(int index) { + return null; + } + + @Override + public Integer set(int i, Integer integer) { + return null; + } +} + +// FILE: 1.kt +class A : Java1() + +fun box(): String { + val list = A() + list.add(1) + list.removeAt(0) + if (list.isNotEmpty()) return "Not empty" + if (list.size != 0) return "Size = ${list.size}" + return "OK" +} diff --git a/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.fir.kt b/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.fir.kt new file mode 100644 index 00000000000..ee942f975ab --- /dev/null +++ b/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.fir.kt @@ -0,0 +1,34 @@ +// WITH_STDLIB +// SCOPE_DUMP: A:removeAt +// ISSUE: KT-65410 + +// FILE: Java1.java +import kotlin.collections.AbstractMutableList; + +public class Java1 extends AbstractMutableList { + @Override + public int getSize() { + return 0; + } + + @Override + public void add(int i, Integer integer) {} + + @Override + public Integer removeAt(int i) { + return null; + } + + @Override + public Integer get(int index) { + return null; + } + + @Override + public Integer set(int i, Integer integer) { + return null; + } +} + +// FILE: 1.kt +class A : Java1() diff --git a/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.fir.overrides.txt b/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.fir.overrides.txt new file mode 100644 index 00000000000..cafb51bfa0e --- /dev/null +++ b/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.fir.overrides.txt @@ -0,0 +1,14 @@ +A: + [Enhancement]: public open fun removeAt(i: R|kotlin/Int|): R|kotlin/Int!| from Use site scope of /A [id: 0] + [Enhancement]: public open fun removeAt(i: R|kotlin/Int|): R|kotlin/Int!| from Java enhancement scope for /Java1 [id: 0] + [SubstitutionOverride(DeclarationSite)]: /* hidden due to clash */ public abstract fun removeAt(index: R|kotlin/Int|): R|kotlin/Int!| from Use site scope of /A [id: 0] + [SubstitutionOverride(DeclarationSite)]: /* hidden due to clash */ public abstract fun removeAt(index: R|kotlin/Int|): R|kotlin/Int!| from Java enhancement scope for /Java1 [id: 0] + [SubstitutionOverride(DeclarationSite)]: public abstract fun removeAt(index: R|kotlin/Int|): R|kotlin/Int!| from Substitution scope for [Use site scope of kotlin/collections/AbstractMutableList] for type Java1 [id: 1] + [Library]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Use site scope of kotlin/collections/AbstractMutableList [id: 2] + [SubstitutionOverride(DeclarationSite)]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Substitution scope for [Use site scope of kotlin/collections/MutableList] for type kotlin/collections/AbstractMutableList [id: 3] + [Library]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Use site scope of kotlin/collections/MutableList [id: 4] + [SubstitutionOverride(DeclarationSite)]: public open operator fun removeAt(p0: R|kotlin/Int|): R|ft| from Substitution scope for [Java enhancement scope for java/util/AbstractList] for type kotlin/collections/AbstractMutableList [id: 5] + [Enhancement]: public open operator fun removeAt(p0: R|kotlin/Int|): R|ft| from Java enhancement scope for java/util/AbstractList [id: 6] + [SubstitutionOverride(DeclarationSite)]: public abstract fun removeAt(index: R|kotlin/Int|): R|ft| from Substitution scope for [Use site scope of kotlin/collections/MutableList] for type java/util/AbstractList [id: 7] + [Library]: public abstract fun removeAt(index: R|kotlin/Int|): R|E| from Use site scope of kotlin/collections/MutableList [id: 4] + diff --git a/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt b/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt new file mode 100644 index 00000000000..52c18be84a8 --- /dev/null +++ b/compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt @@ -0,0 +1,34 @@ +// WITH_STDLIB +// SCOPE_DUMP: A:removeAt +// ISSUE: KT-65410 + +// FILE: Java1.java +import kotlin.collections.AbstractMutableList; + +public class Java1 extends AbstractMutableList { + @Override + public int getSize() { + return 0; + } + + @Override + public void add(int i, Integer integer) {} + + @Override + public Integer removeAt(int i) { + return null; + } + + @Override + public Integer get(int index) { + return null; + } + + @Override + public Integer set(int i, Integer integer) { + return null; + } +} + +// FILE: 1.kt +class A : Java1() diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index bf2e62be5a3..e999f1ba605 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -22859,6 +22859,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/notNullAnnotated.kt"); } + @Test + @TestMetadata("removeAt.kt") + public void testRemoveAt() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/primitiveOverrides/removeAt.kt"); + } + @Test @TestMetadata("specializedMap.kt") public void testSpecializedMap() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java index fd026c59f36..45f0cf5202a 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java @@ -8243,6 +8243,12 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt"); } + @Test + @TestMetadata("removeAtInJava.kt") + public void testRemoveAtInJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt"); + } + @Test @TestMetadata("removeAtInt.kt") public void testRemoveAtInt() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 26aaa273a22..dfadbb82016 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -8243,6 +8243,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt"); } + @Test + @TestMetadata("removeAtInJava.kt") + public void testRemoveAtInJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt"); + } + @Test @TestMetadata("removeAtInt.kt") public void testRemoveAtInt() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index 768fe0076ed..37003f2a0b2 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -8243,6 +8243,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt"); } + @Test + @TestMetadata("removeAtInJava.kt") + public void testRemoveAtInJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt"); + } + @Test @TestMetadata("removeAtInt.kt") public void testRemoveAtInt() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index e505c6fc3de..9b6597a3bbb 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -7205,6 +7205,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/collections/removeAtBridgeClashWithJava.kt"); } + @TestMetadata("removeAtInJava.kt") + public void testRemoveAtInJava() throws Exception { + runTest("compiler/testData/codegen/box/collections/removeAtInJava.kt"); + } + @TestMetadata("removeAtInt.kt") public void testRemoveAtInt() throws Exception { runTest("compiler/testData/codegen/box/collections/removeAtInt.kt");