Use protocol name when creating objc protocol wrapper class

This commit is contained in:
Mark Mann
2023-03-23 13:44:43 -07:00
committed by Space Team
parent 51d441ee38
commit b6f669189b
6 changed files with 25 additions and 1 deletions
@@ -444,7 +444,7 @@ internal abstract class ObjCContainerStubBuilder(
metaContainerStub.protocolGetter!! metaContainerStub.protocolGetter!!
} else { } else {
// TODO: handle the case when protocol getter stub can't be compiled. // TODO: handle the case when protocol getter stub can't be compiled.
context.generateNextUniqueId("kniprot_") "${context.generateNextUniqueId("kniprot_")}_${container.name}"
} }
AnnotationStub.ObjC.ExternalClass(protocolGetter) AnnotationStub.ObjC.ExternalClass(protocolGetter)
} }
@@ -0,0 +1,6 @@
package objcinterop {
@ExternalObjCClass(protocolGetter = "kniprot_objcinterop0_Simple") interface SimpleProtocol : ObjCObject
@ExternalObjCClass(protocolGetter = "kniprot_objcinterop0_Simple") interface SimpleProtocolMeta : ObjCObjectMeta /* = ObjCClass */
}
@@ -0,0 +1,3 @@
language = Objective-C
headers = protocol/protocol.h
package = objcinterop
@@ -0,0 +1,3 @@
@protocol Simple
@end
@@ -192,6 +192,12 @@ public class CInteropFModulesTestGenerated extends AbstractNativeCInteropFModule
runTest("native/native.tests/testData/CInterop/framework/frameworkDefs/modulesPod1/"); 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 @Test
@TestMetadata("twoChildren") @TestMetadata("twoChildren")
public void testTwoChildren() throws Exception { public void testTwoChildren() throws Exception {
@@ -192,6 +192,12 @@ public class CInteropNoFModulesTestGenerated extends AbstractNativeCInteropNoFMo
runTest("native/native.tests/testData/CInterop/framework/frameworkDefs/modulesPod1/"); 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 @Test
@TestMetadata("twoChildren") @TestMetadata("twoChildren")
public void testTwoChildren() throws Exception { public void testTwoChildren() throws Exception {