Skip to content

Commit 3ffd474

Browse files
committed
Added missing opt-ins for #174
1 parent e7c5e42 commit 3ffd474

File tree

9 files changed

+21
-12
lines changed

9 files changed

+21
-12
lines changed

core/apple/src/AppleCore.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6-
@file:OptIn(UnsafeNumber::class)
6+
@file:OptIn(UnsafeNumber::class, ExperimentalForeignApi::class)
77

88
package kotlinx.io
99

core/apple/src/BuffersApple.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6-
@file:OptIn(UnsafeNumber::class)
6+
@file:OptIn(UnsafeNumber::class, ExperimentalForeignApi::class)
77

88
package kotlinx.io
99

1010
import kotlinx.cinterop.*
1111
import platform.Foundation.*
12-
import platform.darwin.ByteVar
1312
import platform.darwin.NSUIntegerMax
1413
import platform.posix.*
1514

15+
@OptIn(ExperimentalForeignApi::class)
1616
internal fun Buffer.write(source: CPointer<uint8_tVar>, maxLength: Int) {
1717
require(maxLength >= 0) { "maxLength ($maxLength) must not be negative" }
1818

@@ -51,6 +51,7 @@ internal fun Buffer.readAtMostTo(sink: CPointer<uint8_tVar>, maxLength: Int): In
5151
return toCopy
5252
}
5353

54+
@OptIn(BetaInteropApi::class)
5455
internal fun Buffer.snapshotAsNSData(): NSData {
5556
if (size == 0L) return NSData.data()
5657

core/apple/src/SinksApple.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6+
@file:OptIn(ExperimentalForeignApi::class, ExperimentalNativeApi::class)
7+
68
package kotlinx.io
79

810
import kotlinx.cinterop.*
911
import platform.Foundation.*
1012
import platform.darwin.NSInteger
1113
import platform.darwin.NSUInteger
1214
import platform.posix.uint8_tVar
15+
import kotlin.experimental.ExperimentalNativeApi
1316
import kotlin.native.ref.WeakReference
1417

1518
/**

core/apple/src/SourcesApple.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6+
@file:OptIn(ExperimentalNativeApi::class, ExperimentalForeignApi::class)
7+
68
package kotlinx.io
79

810
import kotlinx.cinterop.*
@@ -11,6 +13,7 @@ import platform.darwin.NSInteger
1113
import platform.darwin.NSUInteger
1214
import platform.darwin.NSUIntegerVar
1315
import platform.posix.uint8_tVar
16+
import kotlin.experimental.ExperimentalNativeApi
1417
import kotlin.native.ref.WeakReference
1518

1619
/**

core/apple/test/NSOutputStreamSinkTest.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6+
@file:OptIn(ExperimentalForeignApi::class)
7+
68
package kotlinx.io
79

8-
import kotlinx.cinterop.ByteVar
9-
import kotlinx.cinterop.UnsafeNumber
10-
import kotlinx.cinterop.get
11-
import kotlinx.cinterop.reinterpret
10+
import kotlinx.cinterop.*
1211
import platform.Foundation.*
1312
import kotlin.test.Test
1413
import kotlin.test.assertEquals

core/apple/test/SinkNSOutputStreamTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6+
@file:OptIn(ExperimentalForeignApi::class)
7+
68
package kotlinx.io
79

810
import kotlinx.atomicfu.atomic

core/apple/test/SourceNSInputStreamTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6+
@file:OptIn(ExperimentalForeignApi::class)
7+
68
package kotlinx.io
79

810
import kotlinx.atomicfu.atomic

core/apple/test/samples/samplesApple.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55

66
package kotlinx.io.samples
77

8-
import kotlinx.cinterop.UnsafeNumber
9-
import kotlinx.cinterop.convert
10-
import kotlinx.cinterop.reinterpret
8+
import kotlinx.cinterop.*
119
import kotlinx.io.*
1210
import platform.Foundation.*
1311
import kotlin.test.Test
@@ -37,7 +35,7 @@ class KotlinxIoSamplesApple {
3735
}
3836

3937
@Test
40-
@OptIn(UnsafeNumber::class)
38+
@OptIn(UnsafeNumber::class, ExperimentalForeignApi::class, BetaInteropApi::class)
4139
fun asStream() {
4240
val buffer = Buffer()
4341
val data = ByteArray(100) { it.toByte() }.toNSData()

core/apple/test/utilApple.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6-
@file:OptIn(UnsafeNumber::class)
6+
@file:OptIn(UnsafeNumber::class, ExperimentalForeignApi::class, ExperimentalForeignApi::class)
77

88
package kotlinx.io
99

@@ -18,6 +18,7 @@ import kotlin.test.fail
1818
import kotlin.time.Duration
1919
import kotlin.time.Duration.Companion.seconds
2020

21+
@OptIn(BetaInteropApi::class)
2122
internal fun ByteArray.toNSData() = if (isNotEmpty()) {
2223
usePinned {
2324
NSData.create(bytes = it.addressOf(0), length = size.convert())

0 commit comments

Comments
 (0)