From 7d1713a4c93d2fc1cff17dfc8dcc994d48bad6cf Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Tue, 11 Sep 2018 14:18:14 +0300 Subject: [PATCH] Mark few JVM-compatibility declarations deprecated. (#2029) --- INTEROP.md | 14 ++++++++++++++ .../src/main/kotlin/kotlin/native/Compatibility.kt | 3 +++ 2 files changed, 17 insertions(+) diff --git a/INTEROP.md b/INTEROP.md index d49f2729ed3..dd71ff65c13 100644 --- a/INTEROP.md +++ b/INTEROP.md @@ -340,6 +340,20 @@ manually: In all cases the C string is supposed to be encoded as UTF-8. +To skip automatic conversion and ensure raw pointers are used in the bindings `noStringConversion` +statement in `.def` file could be used, i.e. +``` + noStringConversion = LoadCursorA LoadCursorW +``` +This way any value of type `CPointer` could be passed as an argument of `const char*` type. +If Kotlin string shall me passed code like that could be used: +```kotlin +memScoped { + LoadCursorA(null, "cursor.bmp".cstr.ptr) // for ASCII version + LoadCursorW(null, "cursor.bmp".wcstr.ptr) // for Unicode version +} +``` + ### Scope-local pointers ### It is possible to create scope-stable pointer of C representation of `CValues` diff --git a/runtime/src/main/kotlin/kotlin/native/Compatibility.kt b/runtime/src/main/kotlin/kotlin/native/Compatibility.kt index b86f05cdd64..c558d5223e6 100644 --- a/runtime/src/main/kotlin/kotlin/native/Compatibility.kt +++ b/runtime/src/main/kotlin/kotlin/native/Compatibility.kt @@ -11,10 +11,12 @@ package kotlin @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD) @Retention(AnnotationRetention.SOURCE) +@Deprecated("Do not use Volatile annotation in pure Kotlin/Native code", level = DeprecationLevel.ERROR) public annotation class Volatile @Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) @Retention(AnnotationRetention.SOURCE) +@Deprecated("Do not use Synchronized annotation in pure Kotlin/Native code", level = DeprecationLevel.ERROR) public annotation class Synchronized /** @@ -22,5 +24,6 @@ public annotation class Synchronized * @throws UnsupportedOperationException always */ @kotlin.internal.InlineOnly +@Deprecated("Do not use 'synchronized' function in Kotlin/Native code", level = DeprecationLevel.ERROR) public actual inline fun synchronized(@Suppress("UNUSED_PARAMETER") lock: Any, block: () -> R): R = throw UnsupportedOperationException("synchronized() is unsupported") \ No newline at end of file