diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.kt b/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.kt new file mode 100644 index 00000000000..0f122f258d6 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.kt @@ -0,0 +1,4 @@ +// !LANGUAGE: +InlineClasses + +@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS") +inline class Z @PublishedApi internal constructor(val value: Int) \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.txt b/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.txt new file mode 100644 index 00000000000..b8cb82916fe --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.txt @@ -0,0 +1,16 @@ +@kotlin.Metadata +public final class Z { + private final field value: int + private synthetic @kotlin.PublishedApi method (p0: int): void + public synthetic final static @org.jetbrains.annotations.NotNull method box-impl(p0: int): Z + public static @kotlin.PublishedApi method constructor-impl(p0: int): int + public method equals(p0: java.lang.Object): boolean + public static method equals-impl(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean + public final static method equals-impl0(p0: int, p1: int): boolean + public final method getValue(): int + public method hashCode(): int + public static method hashCode-impl(p0: int): int + public method toString(): java.lang.String + public static @org.jetbrains.annotations.NotNull method toString-impl(p0: int): java.lang.String + public synthetic final method unbox-impl(): int +} diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt new file mode 100644 index 00000000000..f3c6057c88a --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt @@ -0,0 +1,6 @@ +// !LANGUAGE: +InlineClasses +@file:Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS") +package test + + +inline class Z @PublishedApi internal constructor(val value: Int) \ No newline at end of file diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt new file mode 100644 index 00000000000..8dc619b255d --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.txt @@ -0,0 +1,7 @@ +package test + +public final inline class Z { + /*primary*/ @kotlin.PublishedApi internal constructor Z(/*0*/ value: kotlin.Int) + public final val value: kotlin.Int + public final fun (): kotlin.Int +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 876b1f74833..5a7adf7087b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -319,6 +319,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/primaryValsWithDifferentVisibilities.kt"); } + @TestMetadata("publishedApiAnnotationOnInlineClassConstructor.kt") + public void testPublishedApiAnnotationOnInlineClassConstructor() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/publishedApiAnnotationOnInlineClassConstructor.kt"); + } + @TestMetadata("shapeOfInlineClassWithPrimitive.kt") public void testShapeOfInlineClassWithPrimitive() throws Exception { runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/shapeOfInlineClassWithPrimitive.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java index 5ea9417a067..61d0b1aaa93 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java @@ -1799,6 +1799,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest { runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PropertyField.kt"); } + @TestMetadata("PublishedApiAnnotationOnInlineClassCosntructor.kt") + public void testPublishedApiAnnotationOnInlineClassCosntructor() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt"); + } + @TestMetadata("Setter.kt") public void testSetter() throws Exception { runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/Setter.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java index 12427182875..6e331f44bad 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java @@ -143,6 +143,11 @@ public class LoadKotlinWithTypeTableTestGenerated extends AbstractLoadKotlinWith runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PropertyField.kt"); } + @TestMetadata("PublishedApiAnnotationOnInlineClassCosntructor.kt") + public void testPublishedApiAnnotationOnInlineClassCosntructor() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt"); + } + @TestMetadata("Setter.kt") public void testSetter() throws Exception { runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/Setter.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java index bbb049316a0..fde82426b34 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/javac/LoadJavaUsingJavacTestGenerated.java @@ -1799,6 +1799,11 @@ public class LoadJavaUsingJavacTestGenerated extends AbstractLoadJavaUsingJavacT runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PropertyField.kt"); } + @TestMetadata("PublishedApiAnnotationOnInlineClassCosntructor.kt") + public void testPublishedApiAnnotationOnInlineClassCosntructor() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt"); + } + @TestMetadata("Setter.kt") public void testSetter() throws Exception { runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/Setter.kt"); diff --git a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmProtoBufUtil.kt b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmProtoBufUtil.kt index df7bffff15a..03753054cbc 100644 --- a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmProtoBufUtil.kt +++ b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmProtoBufUtil.kt @@ -86,6 +86,11 @@ object JvmProtoBufUtil { typeTable: TypeTable ): JvmMemberSignature.Method? { val signature = proto.getExtensionOrNull(JvmProtoBuf.constructorSignature) + val name = if (signature != null && signature.hasName()) { + nameResolver.getString(signature.name) + } else { + "" + } val desc = if (signature != null && signature.hasDesc()) { nameResolver.getString(signature.desc) } else { @@ -93,7 +98,7 @@ object JvmProtoBufUtil { mapTypeDefault(it.type(typeTable), nameResolver) ?: return null }.joinToString(separator = "", prefix = "(", postfix = ")V") } - return JvmMemberSignature.Method("", desc) + return JvmMemberSignature.Method(name, desc) } fun getJvmFieldSignature( diff --git a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/LoadJavaClsStubTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/LoadJavaClsStubTestGenerated.java index c41708936a5..093dbb795ca 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/LoadJavaClsStubTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/LoadJavaClsStubTestGenerated.java @@ -143,6 +143,11 @@ public class LoadJavaClsStubTestGenerated extends AbstractLoadJavaClsStubTest { runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PropertyField.kt"); } + @TestMetadata("PublishedApiAnnotationOnInlineClassCosntructor.kt") + public void testPublishedApiAnnotationOnInlineClassCosntructor() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt"); + } + @TestMetadata("Setter.kt") public void testSetter() throws Exception { runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/Setter.kt"); diff --git a/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java index 6d4ed5a4a84..f3971f04589 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java @@ -143,6 +143,11 @@ public class ResolveByStubTestGenerated extends AbstractResolveByStubTest { runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PropertyField.kt"); } + @TestMetadata("PublishedApiAnnotationOnInlineClassCosntructor.kt") + public void testPublishedApiAnnotationOnInlineClassCosntructor() throws Exception { + runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/PublishedApiAnnotationOnInlineClassCosntructor.kt"); + } + @TestMetadata("Setter.kt") public void testSetter() throws Exception { runTest("compiler/testData/loadJava/compiledKotlin/annotations/classMembers/Setter.kt");