diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.kt new file mode 100644 index 00000000000..91a1068280e --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.kt @@ -0,0 +1,5 @@ +inline class InlineCharSequence(private val cs: CharSequence) : CharSequence { + override val length: Int get() = cs.length + override fun get(index: Int): Char = cs[index] + override fun subSequence(startIndex: Int, endIndex: Int): CharSequence = cs.subSequence(startIndex, endIndex) +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.txt new file mode 100644 index 00000000000..e0177b96e6a --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.txt @@ -0,0 +1,24 @@ +@kotlin.Metadata +public final class InlineCharSequence { + // source: 'inlineCharSequence.kt' + private final field cs: java.lang.CharSequence + private synthetic method (p0: java.lang.CharSequence): void + public synthetic final static method box-impl(p0: java.lang.CharSequence): InlineCharSequence + public bridge final method charAt(p0: int): char + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.CharSequence): java.lang.CharSequence + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.CharSequence, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.CharSequence, p1: java.lang.CharSequence): boolean + public method get(p0: int): char + public static method get-impl(p0: java.lang.CharSequence, p1: int): char + public method getLength(): int + public static method getLength-impl(p0: java.lang.CharSequence): int + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.CharSequence): int + public bridge final method length(): int + public @org.jetbrains.annotations.NotNull method subSequence(p0: int, p1: int): java.lang.CharSequence + public static @org.jetbrains.annotations.NotNull method subSequence-impl(p0: java.lang.CharSequence, p1: int, p2: int): java.lang.CharSequence + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.CharSequence): java.lang.String + public synthetic final method unbox-impl(): java.lang.CharSequence +} diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence_ir.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence_ir.txt new file mode 100644 index 00000000000..ddfc96d48ae --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence_ir.txt @@ -0,0 +1,24 @@ +@kotlin.Metadata +public final class InlineCharSequence { + // source: 'inlineCharSequence.kt' + private final @org.jetbrains.annotations.NotNull field cs: java.lang.CharSequence + private synthetic method (p0: java.lang.CharSequence): void + public synthetic final static method box-impl(p0: java.lang.CharSequence): InlineCharSequence + public bridge final method charAt(p0: int): char + public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.CharSequence): java.lang.CharSequence + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: java.lang.CharSequence, p1: java.lang.Object): boolean + public final static method equals-impl0(p0: java.lang.CharSequence, p1: java.lang.CharSequence): boolean + public method get(p0: int): char + public static method get-impl(@org.jetbrains.annotations.NotNull p0: java.lang.CharSequence, p1: int): char + public method getLength(): int + public static method getLength-impl(@org.jetbrains.annotations.NotNull p0: java.lang.CharSequence): int + public method hashCode(): int + public static method hashCode-impl(p0: java.lang.CharSequence): int + public synthetic bridge method length(): int + public @org.jetbrains.annotations.NotNull method subSequence(p0: int, p1: int): java.lang.CharSequence + public static @org.jetbrains.annotations.NotNull method subSequence-impl(@org.jetbrains.annotations.NotNull p0: java.lang.CharSequence, p1: int, p2: int): java.lang.CharSequence + public method toString(): java.lang.String + public static method toString-impl(p0: java.lang.CharSequence): java.lang.String + public synthetic final method unbox-impl(): java.lang.CharSequence +} diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/charSequence.kt b/compiler/testData/codegen/bytecodeListing/specialBridges/charSequence.kt new file mode 100644 index 00000000000..fc7b5db5333 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/charSequence.kt @@ -0,0 +1,9 @@ +abstract class AbstractCharSequence : CharSequence + +class MyCharSequence : CharSequence { + override val length: Int get() = 0 + + override fun get(index: Int): Char = throw Exception() + + override fun subSequence(startIndex: Int, endIndex: Int): CharSequence = this +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/charSequence.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/charSequence.txt new file mode 100644 index 00000000000..2c9e6079936 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/charSequence.txt @@ -0,0 +1,20 @@ +@kotlin.Metadata +public abstract class AbstractCharSequence { + // source: 'charSequence.kt' + public method (): void + public bridge final method charAt(p0: int): char + public abstract method get(p0: int): char + public abstract method getLength(): int + public bridge final method length(): int +} + +@kotlin.Metadata +public final class MyCharSequence { + // source: 'charSequence.kt' + public method (): void + public bridge final method charAt(p0: int): char + public method get(p0: int): char + public method getLength(): int + public bridge final method length(): int + public @org.jetbrains.annotations.NotNull method subSequence(p0: int, p1: int): java.lang.CharSequence +} diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/number.kt b/compiler/testData/codegen/bytecodeListing/specialBridges/number.kt new file mode 100644 index 00000000000..d76d3763261 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/number.kt @@ -0,0 +1,14 @@ +// IGNORE_BACKEND: JVM_IR +// ^ see KT-42578 + +abstract class AbstractNumber : Number() + +class MyNumber : Number() { + override fun toByte(): Byte = 0 + override fun toChar(): Char = 0.toChar() + override fun toDouble(): Double = 0.0 + override fun toFloat(): Float = 0.0f + override fun toInt(): Int = 0 + override fun toLong(): Long = 0 + override fun toShort(): Short = 0 +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/specialBridges/number.txt b/compiler/testData/codegen/bytecodeListing/specialBridges/number.txt new file mode 100644 index 00000000000..124dfea46f6 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/specialBridges/number.txt @@ -0,0 +1,30 @@ +@kotlin.Metadata +public abstract class AbstractNumber { + // source: 'number.kt' + public method (): void + public bridge final method byteValue(): byte + public bridge final method doubleValue(): double + public bridge final method floatValue(): float + public bridge final method intValue(): int + public bridge final method longValue(): long + public bridge final method shortValue(): short +} + +@kotlin.Metadata +public final class MyNumber { + // source: 'number.kt' + public method (): void + public bridge final method byteValue(): byte + public bridge final method doubleValue(): double + public bridge final method floatValue(): float + public bridge final method intValue(): int + public bridge final method longValue(): long + public bridge final method shortValue(): short + public method toByte(): byte + public method toChar(): char + public method toDouble(): double + public method toFloat(): float + public method toInt(): int + public method toLong(): long + public method toShort(): short +} diff --git a/compiler/tests-java8/tests/org/jetbrains/kotlin/checkers/ForeignJava8AnnotationsTestGenerated.java b/compiler/tests-java8/tests/org/jetbrains/kotlin/checkers/ForeignJava8AnnotationsTestGenerated.java index 122b34da2e4..db6e23b57df 100644 --- a/compiler/tests-java8/tests/org/jetbrains/kotlin/checkers/ForeignJava8AnnotationsTestGenerated.java +++ b/compiler/tests-java8/tests/org/jetbrains/kotlin/checkers/ForeignJava8AnnotationsTestGenerated.java @@ -105,19 +105,6 @@ public class ForeignJava8AnnotationsTestGenerated extends AbstractForeignJava8An runTest("compiler/testData/foreignAnnotationsJava8/tests/jspecify/wildcardsWithDefault.kt"); } - @TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/jspecify/kotlin") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Kotlin extends AbstractForeignJava8AnnotationsTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInKotlin() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests/jspecify/kotlin"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - } - @TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/jspecify/warnings") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-java8/tests/org/jetbrains/kotlin/checkers/javac/JavacForeignJava8AnnotationsTestGenerated.java b/compiler/tests-java8/tests/org/jetbrains/kotlin/checkers/javac/JavacForeignJava8AnnotationsTestGenerated.java index 1078c0f7461..dde61069832 100644 --- a/compiler/tests-java8/tests/org/jetbrains/kotlin/checkers/javac/JavacForeignJava8AnnotationsTestGenerated.java +++ b/compiler/tests-java8/tests/org/jetbrains/kotlin/checkers/javac/JavacForeignJava8AnnotationsTestGenerated.java @@ -105,19 +105,6 @@ public class JavacForeignJava8AnnotationsTestGenerated extends AbstractJavacFore runTest("compiler/testData/foreignAnnotationsJava8/tests/jspecify/wildcardsWithDefault.kt"); } - @TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/jspecify/kotlin") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Kotlin extends AbstractJavacForeignJava8AnnotationsTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInKotlin() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests/jspecify/kotlin"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - } - @TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/jspecify/warnings") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 73c1d4568d7..54970740027 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -679,6 +679,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/constructorsWithDefaultParameterValues.kt"); } + @TestMetadata("inlineCharSequence.kt") + public void testInlineCharSequence() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.kt"); + } + @TestMetadata("inlineClassMembersVisibility.kt") public void testInlineClassMembersVisibility() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassMembersVisibility.kt"); @@ -1129,6 +1134,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/specialBridges"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("charSequence.kt") + public void testCharSequence() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/charSequence.kt"); + } + @TestMetadata("contains.kt") public void testContains() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/contains.kt"); @@ -1154,6 +1164,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/noSpecialBridgeIfPresentInSuperClass.kt"); } + @TestMetadata("number.kt") + public void testNumber() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/number.kt"); + } + @TestMetadata("redundantStubForSize.kt") public void testRedundantStubForSize() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/redundantStubForSize.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java index 93a2b2116f9..4943d6c258f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBytecodeListingTestGenerated.java @@ -649,6 +649,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/constructorsWithDefaultParameterValues.kt"); } + @TestMetadata("inlineCharSequence.kt") + public void testInlineCharSequence() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.kt"); + } + @TestMetadata("inlineClassMembersVisibility.kt") public void testInlineClassMembersVisibility() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineClassMembersVisibility.kt"); @@ -1099,6 +1104,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/specialBridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @TestMetadata("charSequence.kt") + public void testCharSequence() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/charSequence.kt"); + } + @TestMetadata("contains.kt") public void testContains() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/contains.kt"); @@ -1124,6 +1134,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/specialBridges/noSpecialBridgeIfPresentInSuperClass.kt"); } + @TestMetadata("number.kt") + public void testNumber() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/specialBridges/number.kt"); + } + @TestMetadata("redundantStubForSize.kt") public void testRedundantStubForSize() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/specialBridges/redundantStubForSize.kt");