Skip to content

Commit 71a3d7d

Browse files
committed
Add the required OptIn annotations
1 parent feb5230 commit 71a3d7d

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

core/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,4 +399,4 @@ tasks.configureEach {
399399
with(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin.apply(rootProject)) {
400400
nodeVersion = "21.0.0-v8-canary202309167e82ab1fa2"
401401
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
402-
}
402+
}

core/linux/src/TimeZoneNative.kt

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

6+
@file:OptIn(ExperimentalForeignApi::class)
67
package kotlinx.datetime
78

89
import kotlinx.cinterop.*
@@ -64,8 +65,8 @@ internal actual fun currentTime(): Instant = memScoped {
6465
val errorStr: String = strerror(errno)?.toKString() ?: "Unknown error"
6566
throw IllegalStateException("Could not obtain the current clock readings from the system: $errorStr")
6667
}
67-
val seconds: Long = tm.tv_sec
68-
val nanoseconds: Int = tm.tv_nsec.toInt()
68+
val seconds: Long = tm.tv_sec.convert<Long>()
69+
val nanoseconds: Int = tm.tv_nsec.convert<Int>()
6970
try {
7071
require(nanoseconds in 0 until NANOS_PER_ONE)
7172
return Instant(seconds, nanoseconds)
@@ -74,5 +75,4 @@ internal actual fun currentTime(): Instant = memScoped {
7475
}
7576
}
7677

77-
@ThreadLocal
7878
private val tzdbOnFilesystem = TzdbOnFilesystem(Path.fromString("/usr/share/zoneinfo"))

core/linux/test/TimeZoneRulesCompleteTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class TimeZoneRulesCompleteTest {
5959
}
6060
}
6161

62+
@OptIn(ExperimentalForeignApi::class)
6263
private inline fun runUnixCommand(command: String): Sequence<String> = sequence {
6364
val pipe = popen(command, "r") ?: error("Failed to run command: $command")
6465
try {

core/nix/src/internal/filesystem.kt

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

6+
@file:OptIn(ExperimentalForeignApi::class)
67
package kotlinx.datetime.internal
78

89
import kotlinx.cinterop.*
@@ -81,7 +82,6 @@ internal fun Path.traverseDirectory(exclude: Set<String> = emptySet(), stripLead
8182
}
8283
}
8384

84-
8585
internal fun Path.readBytes(): ByteArray {
8686
val handler = fopen(this.toString(), "rb") ?: throw RuntimeException("Cannot open file $this")
8787
try {

core/windows/src/TimeZoneNative.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright 2019-2023 JetBrains s.r.o. and contributors.
33
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
44
*/
5-
5+
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
66
package kotlinx.datetime
77

88
import kotlinx.cinterop.*

core/windows/src/TzdbInRegistry.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright 2019-2023 JetBrains s.r.o. and contributors.
33
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
44
*/
5-
5+
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
66
package kotlinx.datetime
77

88
import kotlinx.cinterop.*

0 commit comments

Comments
 (0)