From 9f118d39d2e0716a8e6c335c5cd43fbdd39197c7 Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Thu, 20 Jul 2023 17:40:59 +0200 Subject: [PATCH] Components. Fix Its usage must be marked with '@kotlinx.cinterop.ExperimentalForeignApi' (#3383) * Components. Fix Its usage must be marked with '@kotlinx.cinterop.ExperimentalForeignApi' https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Compose_Publish_2_AllGitHubRelease/4238435?buildTab=dependencies&mode=list&state=failed&type=snapshot&hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildProblemsSection=true&showLog=4238425_373_267&logFilter=debug&logView=flowAware#4238426 Kotlin 1.9 broke source compatibility for native targets, usePinned is now experimental * macOs --- .../kotlin/org/jetbrains/compose/resources/Resource.ios.kt | 2 ++ .../kotlin/org/jetbrains/compose/resources/Resource.macos.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/Resource.ios.kt b/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/Resource.ios.kt index 9d9be82c9a..fda8a5ddb7 100644 --- a/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/Resource.ios.kt +++ b/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/Resource.ios.kt @@ -5,6 +5,7 @@ package org.jetbrains.compose.resources +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.addressOf import kotlinx.cinterop.usePinned import platform.Foundation.NSBundle @@ -17,6 +18,7 @@ actual fun resource(path: String): Resource = UIKitResourceImpl(path) @ExperimentalResourceApi private class UIKitResourceImpl(path: String) : AbstractResourceImpl(path) { + @OptIn(ExperimentalForeignApi::class) override suspend fun readBytes(): ByteArray { val fileManager = NSFileManager.defaultManager() // todo: support fallback path at bundle root? diff --git a/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/Resource.macos.kt b/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/Resource.macos.kt index becf5343ef..0e4dee9096 100644 --- a/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/Resource.macos.kt +++ b/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/Resource.macos.kt @@ -5,6 +5,7 @@ package org.jetbrains.compose.resources +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.addressOf import kotlinx.cinterop.usePinned import platform.Foundation.NSData @@ -16,6 +17,7 @@ actual fun resource(path: String): Resource = MacOSResourceImpl(path) @ExperimentalResourceApi private class MacOSResourceImpl(path: String) : AbstractResourceImpl(path) { + @OptIn(ExperimentalForeignApi::class) override suspend fun readBytes(): ByteArray { val currentDirectoryPath = NSFileManager.defaultManager().currentDirectoryPath val contentsAtPath: NSData? = NSFileManager.defaultManager().run {