diff --git a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/ObjCStubs.kt b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/ObjCStubs.kt index 77a2e791d17..06591ec37b1 100644 --- a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/ObjCStubs.kt +++ b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/ObjCStubs.kt @@ -444,7 +444,7 @@ internal abstract class ObjCContainerStubBuilder( metaContainerStub.protocolGetter!! } else { // TODO: handle the case when protocol getter stub can't be compiled. - context.generateNextUniqueId("kniprot_") + "${context.generateNextUniqueId("kniprot_")}_${container.name}" } AnnotationStub.ObjC.ExternalClass(protocolGetter) } diff --git a/native/native.tests/testData/CInterop/framework/frameworkDefs/protocolDefs/contents.gold.txt b/native/native.tests/testData/CInterop/framework/frameworkDefs/protocolDefs/contents.gold.txt new file mode 100644 index 00000000000..23602488cdb --- /dev/null +++ b/native/native.tests/testData/CInterop/framework/frameworkDefs/protocolDefs/contents.gold.txt @@ -0,0 +1,6 @@ + +package objcinterop { + @ExternalObjCClass(protocolGetter = "kniprot_objcinterop0_Simple") interface SimpleProtocol : ObjCObject + @ExternalObjCClass(protocolGetter = "kniprot_objcinterop0_Simple") interface SimpleProtocolMeta : ObjCObjectMeta /* = ObjCClass */ +} + diff --git a/native/native.tests/testData/CInterop/framework/frameworkDefs/protocolDefs/pod1.def b/native/native.tests/testData/CInterop/framework/frameworkDefs/protocolDefs/pod1.def new file mode 100644 index 00000000000..c25527600df --- /dev/null +++ b/native/native.tests/testData/CInterop/framework/frameworkDefs/protocolDefs/pod1.def @@ -0,0 +1,3 @@ +language = Objective-C +headers = protocol/protocol.h +package = objcinterop diff --git a/native/native.tests/testData/CInterop/framework/protocol.framework/Headers/protocol.h b/native/native.tests/testData/CInterop/framework/protocol.framework/Headers/protocol.h new file mode 100644 index 00000000000..909335ae406 --- /dev/null +++ b/native/native.tests/testData/CInterop/framework/protocol.framework/Headers/protocol.h @@ -0,0 +1,3 @@ + +@protocol Simple +@end \ No newline at end of file diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/CInteropFModulesTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/CInteropFModulesTestGenerated.java index 69e926b19a9..baf4325d98f 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/CInteropFModulesTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/CInteropFModulesTestGenerated.java @@ -192,6 +192,12 @@ public class CInteropFModulesTestGenerated extends AbstractNativeCInteropFModule runTest("native/native.tests/testData/CInterop/framework/frameworkDefs/modulesPod1/"); } + @Test + @TestMetadata("protocolDefs") + public void testProtocolDefs() throws Exception { + runTest("native/native.tests/testData/CInterop/framework/frameworkDefs/protocolDefs/"); + } + @Test @TestMetadata("twoChildren") public void testTwoChildren() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/CInteropNoFModulesTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/CInteropNoFModulesTestGenerated.java index 45621907369..94170a385d6 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/CInteropNoFModulesTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/CInteropNoFModulesTestGenerated.java @@ -192,6 +192,12 @@ public class CInteropNoFModulesTestGenerated extends AbstractNativeCInteropNoFMo runTest("native/native.tests/testData/CInterop/framework/frameworkDefs/modulesPod1/"); } + @Test + @TestMetadata("protocolDefs") + public void testProtocolDefs() throws Exception { + runTest("native/native.tests/testData/CInterop/framework/frameworkDefs/protocolDefs/"); + } + @Test @TestMetadata("twoChildren") public void testTwoChildren() throws Exception {