Skip to content

Commit

Permalink
Mark few JVM-compatibility declarations deprecated. (JetBrains#2029)
Browse files Browse the repository at this point in the history
  • Loading branch information
olonho authored Sep 11, 2018
1 parent 669e38f commit 7d1713a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions INTEROP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<ByteVar>` 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<T>`
Expand Down
3 changes: 3 additions & 0 deletions runtime/src/main/kotlin/kotlin/native/Compatibility.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ 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

/**
* An actual implementation of `synchronized` method. This method is not supported in Kotlin/Native
* @throws UnsupportedOperationException always
*/
@kotlin.internal.InlineOnly
@Deprecated("Do not use 'synchronized' function in Kotlin/Native code", level = DeprecationLevel.ERROR)
public actual inline fun <R> synchronized(@Suppress("UNUSED_PARAMETER") lock: Any, block: () -> R): R =
throw UnsupportedOperationException("synchronized() is unsupported")

0 comments on commit 7d1713a

Please sign in to comment.