[K/N] Add ObjCName annotation (#4815)

This commit is contained in:
Rick Clephas
2022-07-23 18:58:06 +02:00
committed by GitHub
parent edf9e05b13
commit 5a5e6ad8cd
22 changed files with 1372 additions and 78 deletions
@@ -5,6 +5,8 @@
package kotlin.native
import kotlin.experimental.ExperimentalObjCName
/**
* Makes top level function available from C/C++ code with the given name.
*
@@ -46,3 +48,20 @@ public expect annotation class CName(val externName: String = "", val shortName:
@Retention(AnnotationRetention.BINARY)
@OptionalExpectation
expect annotation class FreezingIsDeprecated
/**
* Instructs the Kotlin compiler to use a custom Objective-C and/or Swift name for this class, property, parameter or function.
* @param exact specifies if the name of a class should be interpreted as the exact name.
* E.g. the compiler won't add a top level prefix or the outer class names to exact names.
*/
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.PROPERTY,
AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.FUNCTION
)
@Retention(AnnotationRetention.BINARY)
@MustBeDocumented
@OptionalExpectation
@ExperimentalObjCName
public expect annotation class ObjCName(val name: String = "", val swiftName: String = "", val exact: Boolean = false)
@@ -0,0 +1,15 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.experimental
/**
* This annotation marks the experimental [ObjCName][kotlin.native.ObjCName] annotation.
*/
@RequiresOptIn
@Target(AnnotationTarget.ANNOTATION_CLASS)
@Retention(AnnotationRetention.BINARY)
@MustBeDocumented
public annotation class ExperimentalObjCName