diff --git a/native/objcexport-header-generator/test/org/jetbrains/kotlin/backend/konan/tests/ObjCExportHeaderGeneratorTest.kt b/native/objcexport-header-generator/test/org/jetbrains/kotlin/backend/konan/tests/ObjCExportHeaderGeneratorTest.kt index c99d237c448..32cf51c29cf 100644 --- a/native/objcexport-header-generator/test/org/jetbrains/kotlin/backend/konan/tests/ObjCExportHeaderGeneratorTest.kt +++ b/native/objcexport-header-generator/test/org/jetbrains/kotlin/backend/konan/tests/ObjCExportHeaderGeneratorTest.kt @@ -115,6 +115,11 @@ class ObjCExportHeaderGeneratorTest(val generator: HeaderGenerator) { doTest(headersTestDataDir.resolve("kdocWithBlockTags")) } + @Test + fun `test - classWithMustBeDocumentedAnnotation`() { + doTest(headersTestDataDir.resolve("classWithMustBeDocumentedAnnotation")) + } + @Test fun `test - functionWithMustBeDocumentedAnnotation`() { doTest(headersTestDataDir.resolve("functionWithMustBeDocumentedAnnotation")) diff --git a/native/objcexport-header-generator/testData/headers/classWithMustBeDocumentedAnnotation/!classWithMustBeDocumentedAnnotation.h b/native/objcexport-header-generator/testData/headers/classWithMustBeDocumentedAnnotation/!classWithMustBeDocumentedAnnotation.h new file mode 100644 index 00000000000..088fe5cd498 --- /dev/null +++ b/native/objcexport-header-generator/testData/headers/classWithMustBeDocumentedAnnotation/!classWithMustBeDocumentedAnnotation.h @@ -0,0 +1,34 @@ +#import +#import +#import +#import +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-warning-option" +#pragma clang diagnostic ignored "-Wincompatible-property-type" +#pragma clang diagnostic ignored "-Wnullability" + +#pragma push_macro("_Nullable_result") +#if !__has_feature(nullability_nullable_result) +#undef _Nullable_result +#define _Nullable_result _Nullable +#endif + + +/** + * @note annotations + * ImportantAnnotation +*/ +__attribute__((objc_subclassing_restricted)) +@interface Foo : Base +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@end + +#pragma pop_macro("_Nullable_result") +#pragma clang diagnostic pop +NS_ASSUME_NONNULL_END diff --git a/native/objcexport-header-generator/testData/headers/classWithMustBeDocumentedAnnotation/Foo.kt b/native/objcexport-header-generator/testData/headers/classWithMustBeDocumentedAnnotation/Foo.kt new file mode 100644 index 00000000000..d852a716637 --- /dev/null +++ b/native/objcexport-header-generator/testData/headers/classWithMustBeDocumentedAnnotation/Foo.kt @@ -0,0 +1,5 @@ +@kotlin.annotation.MustBeDocumented +annotation class ImportantAnnotation + +@ImportantAnnotation +class Foo \ No newline at end of file diff --git a/native/objcexport-header-generator/testData/headers/functionWithMustBeDocumentedAnnotation/!functionWithMustBeDocumentedAnnotation.h b/native/objcexport-header-generator/testData/headers/functionWithMustBeDocumentedAnnotation/!functionWithMustBeDocumentedAnnotation.h index 088fe5cd498..90ffeb5ed8c 100644 --- a/native/objcexport-header-generator/testData/headers/functionWithMustBeDocumentedAnnotation/!functionWithMustBeDocumentedAnnotation.h +++ b/native/objcexport-header-generator/testData/headers/functionWithMustBeDocumentedAnnotation/!functionWithMustBeDocumentedAnnotation.h @@ -18,15 +18,14 @@ NS_ASSUME_NONNULL_BEGIN #define _Nullable_result _Nullable #endif +__attribute__((objc_subclassing_restricted)) +@interface FooKt : Base /** * @note annotations * ImportantAnnotation */ -__attribute__((objc_subclassing_restricted)) -@interface Foo : Base -- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); -+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); ++ (void)fooMyParameter:(NSString *)myParameter __attribute__((swift_name("foo(myParameter:)"))); @end #pragma pop_macro("_Nullable_result") diff --git a/native/objcexport-header-generator/testData/headers/functionWithMustBeDocumentedAnnotation/Foo.kt b/native/objcexport-header-generator/testData/headers/functionWithMustBeDocumentedAnnotation/Foo.kt index d852a716637..d83bf6989d6 100644 --- a/native/objcexport-header-generator/testData/headers/functionWithMustBeDocumentedAnnotation/Foo.kt +++ b/native/objcexport-header-generator/testData/headers/functionWithMustBeDocumentedAnnotation/Foo.kt @@ -2,4 +2,4 @@ annotation class ImportantAnnotation @ImportantAnnotation -class Foo \ No newline at end of file +fun foo(myParameter: String) = Unit \ No newline at end of file