diff --git a/components/resources/demo/shared/src/jsMain/kotlin/main.js.kt b/components/resources/demo/shared/src/jsMain/kotlin/main.js.kt index 6a065b6f07..ecbb400a2a 100644 --- a/components/resources/demo/shared/src/jsMain/kotlin/main.js.kt +++ b/components/resources/demo/shared/src/jsMain/kotlin/main.js.kt @@ -5,13 +5,12 @@ import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.window.CanvasBasedWindow -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.configureWebResources import org.jetbrains.compose.resources.demo.shared.UseResources import org.jetbrains.skiko.wasm.onWasmReady -@OptIn(ExperimentalComposeUiApi::class, ExperimentalResourceApi::class) +@OptIn(ExperimentalComposeUiApi::class) fun main() { configureWebResources { // Not necessary - It's the same as the default. We add it here just to present this feature. diff --git a/components/resources/demo/shared/src/wasmJsMain/kotlin/main.wasm.kt b/components/resources/demo/shared/src/wasmJsMain/kotlin/main.wasm.kt index bcd51ccb26..13e78a309a 100644 --- a/components/resources/demo/shared/src/wasmJsMain/kotlin/main.wasm.kt +++ b/components/resources/demo/shared/src/wasmJsMain/kotlin/main.wasm.kt @@ -1,10 +1,9 @@ import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.window.CanvasBasedWindow -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.configureWebResources import org.jetbrains.compose.resources.demo.shared.UseResources -@OptIn(ExperimentalComposeUiApi::class, ExperimentalResourceApi::class) +@OptIn(ExperimentalComposeUiApi::class) fun main() { configureWebResources { // Not necessary - It's the same as the default. We add it here just to present this feature. diff --git a/components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/FontResources.android.kt b/components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/FontResources.android.kt index 854b66580b..c85d34c1e8 100644 --- a/components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/FontResources.android.kt +++ b/components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/FontResources.android.kt @@ -5,7 +5,6 @@ import androidx.compose.runtime.remember import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.font.* -@ExperimentalResourceApi @Composable actual fun Font(resource: FontResource, weight: FontWeight, style: FontStyle): Font { val environment = LocalComposeEnvironment.current.rememberEnvironment() diff --git a/components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/ResourceReader.android.kt b/components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/ResourceReader.android.kt index f4630dcc32..5ec66d7f02 100644 --- a/components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/ResourceReader.android.kt +++ b/components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/ResourceReader.android.kt @@ -19,7 +19,6 @@ internal actual fun getPlatformResourceReader(): ResourceReader = object : Resou return result } - @OptIn(ExperimentalResourceApi::class) override fun getUri(path: String): String { val classLoader = getClassLoader() val resource = classLoader.getResource(path) ?: run { @@ -31,7 +30,6 @@ internal actual fun getPlatformResourceReader(): ResourceReader = object : Resou return resource.toURI().toString() } - @OptIn(ExperimentalResourceApi::class) private fun getResourceAsStream(path: String): InputStream { val classLoader = getClassLoader() val resource = classLoader.getResourceAsStream(path) ?: run { diff --git a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/FontResources.kt b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/FontResources.kt index 0054858dcf..1493218d58 100644 --- a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/FontResources.kt +++ b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/FontResources.kt @@ -12,23 +12,10 @@ import androidx.compose.ui.text.font.* * * @see Resource */ -@ExperimentalResourceApi @Immutable class FontResource @InternalResourceApi constructor(id: String, items: Set): Resource(id, items) -/** - * Creates an [FontResource] object with the specified path. - * - * @param path The path to the font resource file. - * @return A new [FontResource] object. - */ -@ExperimentalResourceApi -fun FontResource(path: String): FontResource = FontResource( - id = "FontResource:$path", - items = setOf(ResourceItem(emptySet(), path, -1, -1)) -) - /** * Creates a font using the specified font resource, weight, and style. * @@ -41,7 +28,6 @@ fun FontResource(path: String): FontResource = FontResource( * @throws NotFoundException if the specified resource ID is not found. */ @Composable -@ExperimentalResourceApi expect fun Font( resource: FontResource, weight: FontWeight = FontWeight.Normal, diff --git a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ImageResources.kt b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ImageResources.kt index 2940095041..cdb9d85224 100644 --- a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ImageResources.kt +++ b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ImageResources.kt @@ -21,23 +21,10 @@ import org.jetbrains.compose.resources.vector.xmldom.Element * @param id The unique identifier of the drawable resource. * @param items The set of resource items associated with the image resource. */ -@ExperimentalResourceApi @Immutable class DrawableResource @InternalResourceApi constructor(id: String, items: Set) : Resource(id, items) -/** - * Creates an [DrawableResource] object with the specified path. - * - * @param path The path of the drawable resource. - * @return An [DrawableResource] object. - */ -@ExperimentalResourceApi -fun DrawableResource(path: String): DrawableResource = DrawableResource( - id = "DrawableResource:$path", - items = setOf(ResourceItem(emptySet(), path, -1, -1)) -) - /** * Retrieves a [Painter] using the specified drawable resource. * Automatically select a type of the Painter depending on the file extension. @@ -45,7 +32,6 @@ fun DrawableResource(path: String): DrawableResource = DrawableResource( * @param resource The drawable resource to be used. * @return The [Painter] loaded from the resource. */ -@ExperimentalResourceApi @Composable fun painterResource(resource: DrawableResource): Painter { val environment = LocalComposeEnvironment.current.rememberEnvironment() @@ -67,7 +53,6 @@ private val emptyImageBitmap: ImageBitmap by lazy { ImageBitmap(1, 1) } * @param resource The drawable resource to be used. * @return The ImageBitmap loaded from the resource. */ -@ExperimentalResourceApi @Composable fun imageResource(resource: DrawableResource): ImageBitmap { val resourceReader = LocalResourceReader.current @@ -91,7 +76,6 @@ private val emptyImageVector: ImageVector by lazy { * @param resource The drawable resource to be used. * @return The ImageVector loaded from the resource. */ -@ExperimentalResourceApi @Composable fun vectorResource(resource: DrawableResource): ImageVector { val resourceReader = LocalResourceReader.current diff --git a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/PluralStringResources.kt b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/PluralStringResources.kt index 477e1ba3ba..abe769000f 100644 --- a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/PluralStringResources.kt +++ b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/PluralStringResources.kt @@ -11,7 +11,6 @@ import org.jetbrains.compose.resources.plural.PluralRuleList * @param key The key used to retrieve the string resource. * @param items The set of resource items associated with the string resource. */ -@ExperimentalResourceApi @Immutable class PluralStringResource @InternalResourceApi constructor(id: String, val key: String, items: Set) : Resource(id, items) @@ -25,7 +24,6 @@ class PluralStringResource * * @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file. */ -@ExperimentalResourceApi @Composable fun pluralStringResource(resource: PluralStringResource, quantity: Int): String { val resourceReader = LocalResourceReader.current @@ -44,11 +42,9 @@ fun pluralStringResource(resource: PluralStringResource, quantity: Int): String * * @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file. */ -@ExperimentalResourceApi suspend fun getPluralString(resource: PluralStringResource, quantity: Int): String = loadPluralString(resource, quantity, DefaultResourceReader, getResourceEnvironment()) -@OptIn(InternalResourceApi::class, ExperimentalResourceApi::class) private suspend fun loadPluralString( resource: PluralStringResource, quantity: Int, @@ -78,7 +74,6 @@ private suspend fun loadPluralString( * * @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file. */ -@ExperimentalResourceApi @Composable fun pluralStringResource(resource: PluralStringResource, quantity: Int, vararg formatArgs: Any): String { val resourceReader = LocalResourceReader.current @@ -99,7 +94,6 @@ fun pluralStringResource(resource: PluralStringResource, quantity: Int, vararg f * * @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file. */ -@ExperimentalResourceApi suspend fun getPluralString(resource: PluralStringResource, quantity: Int, vararg formatArgs: Any): String = loadPluralString( resource, quantity, @@ -108,7 +102,6 @@ suspend fun getPluralString(resource: PluralStringResource, quantity: Int, varar getResourceEnvironment(), ) -@OptIn(ExperimentalResourceApi::class) private suspend fun loadPluralString( resource: PluralStringResource, quantity: Int, diff --git a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Resource.kt b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Resource.kt index e752cb8422..6c4d4edd75 100644 --- a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Resource.kt +++ b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Resource.kt @@ -14,7 +14,6 @@ annotation class InternalResourceApi * @property id The ID of the resource. * @property items The set of resource items associated with the resource. */ -@ExperimentalResourceApi @Immutable sealed class Resource @InternalResourceApi constructor( diff --git a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceEnvironment.kt b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceEnvironment.kt index 00f322fb09..51b37b8313 100644 --- a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceEnvironment.kt +++ b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceEnvironment.kt @@ -48,7 +48,7 @@ internal expect fun getSystemEnvironment(): ResourceEnvironment */ internal var getResourceEnvironment = ::getSystemEnvironment -@OptIn(InternalResourceApi::class, ExperimentalResourceApi::class) +@OptIn(InternalResourceApi::class) internal fun Resource.getResourceItemByEnvironment(environment: ResourceEnvironment): ResourceItem { //Priority of environments: https://developer.android.com/guide/topics/resources/providing-resources#table2 items.toList() diff --git a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceReader.kt b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceReader.kt index d34f3b782e..7c2979e586 100644 --- a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceReader.kt +++ b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceReader.kt @@ -2,7 +2,6 @@ package org.jetbrains.compose.resources import androidx.compose.runtime.staticCompositionLocalOf -@ExperimentalResourceApi class MissingResourceException(path: String) : Exception("Missing resource with path: $path") /** diff --git a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringArrayResources.kt b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringArrayResources.kt index 2ddfe5a897..6eb35147e8 100644 --- a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringArrayResources.kt +++ b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringArrayResources.kt @@ -16,7 +16,6 @@ import org.jetbrains.compose.resources.vector.xmldom.NodeList * @param key The key used to retrieve the string array resource. * @param items The set of resource items associated with the string array resource. */ -@ExperimentalResourceApi @Immutable class StringArrayResource @InternalResourceApi constructor(id: String, val key: String, items: Set) : Resource(id, items) @@ -29,7 +28,6 @@ class StringArrayResource * * @throws IllegalStateException if the string array with the given ID is not found. */ -@ExperimentalResourceApi @Composable fun stringArrayResource(resource: StringArrayResource): List { val resourceReader = LocalResourceReader.current @@ -47,11 +45,9 @@ fun stringArrayResource(resource: StringArrayResource): List { * * @throws IllegalStateException if the string array with the given ID is not found. */ -@ExperimentalResourceApi suspend fun getStringArray(resource: StringArrayResource): List = loadStringArray(resource, DefaultResourceReader, getResourceEnvironment()) -@OptIn(ExperimentalResourceApi::class, InternalResourceApi::class) private suspend fun loadStringArray( resource: StringArrayResource, resourceReader: ResourceReader, diff --git a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringResources.kt b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringResources.kt index dab3241d2f..9fcbc4c9b9 100644 --- a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringResources.kt +++ b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringResources.kt @@ -9,7 +9,6 @@ import androidx.compose.runtime.* * @param key The key used to retrieve the string resource. * @param items The set of resource items associated with the string resource. */ -@ExperimentalResourceApi @Immutable class StringResource @InternalResourceApi constructor(id: String, val key: String, items: Set) : Resource(id, items) @@ -22,7 +21,6 @@ class StringResource * * @throws IllegalArgumentException If the provided ID is not found in the resource file. */ -@ExperimentalResourceApi @Composable fun stringResource(resource: StringResource): String { val resourceReader = LocalResourceReader.current @@ -40,11 +38,9 @@ fun stringResource(resource: StringResource): String { * * @throws IllegalArgumentException If the provided ID is not found in the resource file. */ -@ExperimentalResourceApi suspend fun getString(resource: StringResource): String = loadString(resource, DefaultResourceReader, getResourceEnvironment()) -@OptIn(ExperimentalResourceApi::class, InternalResourceApi::class) private suspend fun loadString( resource: StringResource, resourceReader: ResourceReader, @@ -64,7 +60,6 @@ private suspend fun loadString( * * @throws IllegalArgumentException If the provided ID is not found in the resource file. */ -@ExperimentalResourceApi @Composable fun stringResource(resource: StringResource, vararg formatArgs: Any): String { val resourceReader = LocalResourceReader.current @@ -84,7 +79,6 @@ fun stringResource(resource: StringResource, vararg formatArgs: Any): String { * * @throws IllegalArgumentException If the provided ID is not found in the resource file. */ -@ExperimentalResourceApi suspend fun getString(resource: StringResource, vararg formatArgs: Any): String = loadString( resource, formatArgs.map { it.toString() }, @@ -92,7 +86,6 @@ suspend fun getString(resource: StringResource, vararg formatArgs: Any): String getResourceEnvironment() ) -@OptIn(ExperimentalResourceApi::class) private suspend fun loadString( resource: StringResource, args: List, diff --git a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/MalformedXMLException.kt b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/MalformedXMLException.kt index 48bb17f371..50c9c221ce 100644 --- a/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/MalformedXMLException.kt +++ b/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/MalformedXMLException.kt @@ -1,9 +1,6 @@ package org.jetbrains.compose.resources.vector.xmldom -import org.jetbrains.compose.resources.ExperimentalResourceApi - /** * Error throw when parsed XML is malformed */ -@ExperimentalResourceApi class MalformedXMLException(message: String?) : Exception(message) diff --git a/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt b/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt index fba9c1daad..d12ececcda 100644 --- a/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt +++ b/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt @@ -9,7 +9,7 @@ import kotlinx.coroutines.test.runTest import org.jetbrains.skiko.URIManager import kotlin.test.* -@OptIn(ExperimentalTestApi::class, ExperimentalResourceApi::class, InternalResourceApi::class) +@OptIn(ExperimentalTestApi::class, InternalResourceApi::class) class ComposeResourceTest { init { @@ -20,7 +20,7 @@ class ComposeResourceTest { @Test fun testCountRecompositions() = runComposeUiTest { - var res by mutableStateOf(DrawableResource("1.png")) + var res by mutableStateOf(TestDrawableResource("1.png")) val recompositionsCounter = RecompositionsCounter() setContent { CompositionLocalProvider(LocalComposeEnvironment provides TestComposeEnvironment) { @@ -31,7 +31,7 @@ class ComposeResourceTest { } } waitForIdle() - res = DrawableResource("2.png") + res = TestDrawableResource("2.png") waitForIdle() assertEquals(2, recompositionsCounter.count) } @@ -39,7 +39,7 @@ class ComposeResourceTest { @Test fun testImageResourceCache() = runComposeUiTest { val testResourceReader = TestResourceReader() - var res by mutableStateOf(DrawableResource("1.png")) + var res by mutableStateOf(TestDrawableResource("1.png")) setContent { CompositionLocalProvider( LocalResourceReader provides testResourceReader, @@ -49,9 +49,9 @@ class ComposeResourceTest { } } waitForIdle() - res = DrawableResource("2.png") + res = TestDrawableResource("2.png") waitForIdle() - res = DrawableResource("1.png") + res = TestDrawableResource("1.png") waitForIdle() assertEquals( diff --git a/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ResourceTest.kt b/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ResourceTest.kt index 61bccc16c0..e530054bce 100644 --- a/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ResourceTest.kt +++ b/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ResourceTest.kt @@ -10,16 +10,15 @@ import org.jetbrains.compose.resources.ThemeQualifier.DARK import org.jetbrains.compose.resources.ThemeQualifier.LIGHT import kotlin.test.* -@OptIn(ExperimentalResourceApi::class, InternalResourceApi::class) class ResourceTest { @Test fun testResourceEquals() { - assertEquals(DrawableResource("a"), DrawableResource("a")) + assertEquals(TestDrawableResource("a"), TestDrawableResource("a")) } @Test fun testResourceNotEquals() { - assertNotEquals(DrawableResource("a"), DrawableResource("b")) + assertNotEquals(TestDrawableResource("a"), TestDrawableResource("b")) } @Test diff --git a/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/TestUtils.kt b/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/TestUtils.kt index d36ac89781..e260331f78 100644 --- a/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/TestUtils.kt +++ b/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/TestUtils.kt @@ -17,27 +17,29 @@ private val cvrMap: Map = mapOf( "str_arr" to ResourceItem(setOf(), "strings.cvr", 211, 47), ) -@OptIn(ExperimentalResourceApi::class) internal fun TestStringResource(key: String) = StringResource( "STRING:$key", key, setOf(cvrMap[key] ?: error("String ID=`$key` is not found!")) ) -@OptIn(ExperimentalResourceApi::class) internal fun TestStringArrayResource(key: String) = StringArrayResource( "STRING:$key", key, setOf(cvrMap[key] ?: error("String ID=`$key` is not found!")) ) -@OptIn(ExperimentalResourceApi::class) internal fun TestPluralStringResource(key: String) = PluralStringResource( "PLURALS:$key", key, setOf(cvrMap[key] ?: error("String ID=`$key` is not found!")) ) +internal fun TestDrawableResource(path: String) = DrawableResource( + path, + setOf(ResourceItem(emptySet(), path, -1, -1)) +) + internal fun parsePluralSamples(samples: String): List { return samples.split(',').flatMap { val range = it.trim() diff --git a/components/resources/library/src/desktopMain/kotlin/org/jetbrains/compose/resources/ResourceReader.desktop.kt b/components/resources/library/src/desktopMain/kotlin/org/jetbrains/compose/resources/ResourceReader.desktop.kt index ab9ffe4a3a..25d4ef44c1 100644 --- a/components/resources/library/src/desktopMain/kotlin/org/jetbrains/compose/resources/ResourceReader.desktop.kt +++ b/components/resources/library/src/desktopMain/kotlin/org/jetbrains/compose/resources/ResourceReader.desktop.kt @@ -18,14 +18,12 @@ internal actual fun getPlatformResourceReader(): ResourceReader = object : Resou return result } - @OptIn(ExperimentalResourceApi::class) override fun getUri(path: String): String { val classLoader = getClassLoader() val resource = classLoader.getResource(path) ?: throw MissingResourceException(path) return resource.toURI().toString() } - @OptIn(ExperimentalResourceApi::class) private fun getResourceAsStream(path: String): InputStream { val classLoader = getClassLoader() return classLoader.getResourceAsStream(path) ?: throw MissingResourceException(path) diff --git a/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.ios.kt b/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.ios.kt index 9d4ee1c9a6..0da7725bc3 100644 --- a/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.ios.kt +++ b/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.ios.kt @@ -5,7 +5,6 @@ import kotlinx.cinterop.usePinned import platform.Foundation.* import platform.posix.memcpy -@OptIn(ExperimentalResourceApi::class) internal actual fun getPlatformResourceReader(): ResourceReader = object : ResourceReader { override suspend fun read(path: String): ByteArray { val data = readData(getPathInBundle(path)) diff --git a/components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ImageResources.js.kt b/components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ImageResources.js.kt index 8061e6529b..725ffd532d 100644 --- a/components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ImageResources.js.kt +++ b/components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ImageResources.js.kt @@ -3,7 +3,6 @@ package org.jetbrains.compose.resources import org.jetbrains.compose.resources.vector.xmldom.* import org.w3c.dom.parsing.DOMParser -@OptIn(ExperimentalResourceApi::class) internal actual fun ByteArray.toXmlElement(): Element { val xmlString = decodeToString() val xmlDom = DOMParser().parseFromString(xmlString, "application/xml") diff --git a/components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.js.kt b/components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.js.kt index f249c676ce..0dbaeac1fa 100644 --- a/components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.js.kt +++ b/components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.js.kt @@ -7,7 +7,6 @@ import org.khronos.webgl.Int8Array import org.w3c.files.Blob import kotlin.js.Promise -@OptIn(ExperimentalResourceApi::class) internal actual fun getPlatformResourceReader(): ResourceReader = object : ResourceReader { override suspend fun read(path: String): ByteArray { return readAsBlob(path).asByteArray() diff --git a/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.macos.kt b/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.macos.kt index 10a5969b08..4b042d1108 100644 --- a/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.macos.kt +++ b/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.macos.kt @@ -5,7 +5,6 @@ import kotlinx.cinterop.usePinned import platform.Foundation.* import platform.posix.memcpy -@OptIn(ExperimentalResourceApi::class) internal actual fun getPlatformResourceReader(): ResourceReader = object : ResourceReader { override suspend fun read(path: String): ByteArray { val data = readData(getPathOnDisk(path)) diff --git a/components/resources/library/src/nativeMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/DomXmlParser.kt b/components/resources/library/src/nativeMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/DomXmlParser.kt index 3d2a94a47b..ab6b51d30e 100644 --- a/components/resources/library/src/nativeMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/DomXmlParser.kt +++ b/components/resources/library/src/nativeMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/DomXmlParser.kt @@ -4,7 +4,6 @@ */ package org.jetbrains.compose.resources.vector.xmldom -import org.jetbrains.compose.resources.ExperimentalResourceApi import platform.Foundation.NSError import platform.Foundation.NSString import platform.Foundation.NSUTF8StringEncoding @@ -58,7 +57,6 @@ private class ElementImpl( override fun lookupPrefix(namespaceURI: String): String = prefixMap[namespaceURI] ?: "" } -@OptIn(ExperimentalResourceApi::class) @Suppress("CONFLICTING_OVERLOADS", "PARAMETER_NAME_CHANGED_ON_OVERRIDE") private class DomXmlParser : NSObject(), NSXMLParserDelegateProtocol { diff --git a/components/resources/library/src/skikoMain/kotlin/org/jetbrains/compose/resources/FontResources.skiko.kt b/components/resources/library/src/skikoMain/kotlin/org/jetbrains/compose/resources/FontResources.skiko.kt index b15d7c0dfc..5390361c63 100644 --- a/components/resources/library/src/skikoMain/kotlin/org/jetbrains/compose/resources/FontResources.skiko.kt +++ b/components/resources/library/src/skikoMain/kotlin/org/jetbrains/compose/resources/FontResources.skiko.kt @@ -29,7 +29,6 @@ private val emptyFontBase64 = @OptIn(ExperimentalEncodingApi::class) private val defaultEmptyFont by lazy { Font("org.jetbrains.compose.emptyFont", Base64.decode(emptyFontBase64)) } -@ExperimentalResourceApi @Composable actual fun Font(resource: FontResource, weight: FontWeight, style: FontStyle): Font { val resourceReader = LocalResourceReader.current diff --git a/components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ImageResources.wasmJs.kt b/components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ImageResources.wasmJs.kt index 8cd2208f30..4de24550e7 100644 --- a/components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ImageResources.wasmJs.kt +++ b/components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ImageResources.wasmJs.kt @@ -5,7 +5,6 @@ import org.jetbrains.compose.resources.vector.xmldom.ElementImpl import org.jetbrains.compose.resources.vector.xmldom.MalformedXMLException import org.w3c.dom.parsing.DOMParser -@OptIn(ExperimentalResourceApi::class) internal actual fun ByteArray.toXmlElement(): Element { val xmlString = decodeToString() val xmlDom = DOMParser().parseFromString(xmlString, "application/xml".toJsString()) diff --git a/components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.wasmJs.kt b/components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.wasmJs.kt index c3dbae6c41..3a78cdfcaf 100644 --- a/components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.wasmJs.kt +++ b/components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.wasmJs.kt @@ -22,7 +22,6 @@ private external fun jsExportInt8ArrayToWasm(src: Int8Array, size: Int, dstAddr: @JsFun("(blob) => blob.arrayBuffer()") private external fun jsExportBlobAsArrayBuffer(blob: Blob): Promise -@OptIn(ExperimentalResourceApi::class) internal actual fun getPlatformResourceReader(): ResourceReader = object : ResourceReader { override suspend fun read(path: String): ByteArray { return readAsBlob(path).asByteArray() diff --git a/components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt b/components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt index f1ebbc5531..aa44111987 100644 --- a/components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt +++ b/components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt @@ -6,7 +6,6 @@ package org.jetbrains.compose.resources * @see configureWebResources - for overriding the default configuration. */ @Suppress("unused") -@ExperimentalResourceApi object WebResourcesConfiguration { internal var getResourcePath: (path: String) -> String = { "./$it" } @@ -16,7 +15,6 @@ object WebResourcesConfiguration { * * @param map the mapping function that takes a path String and returns a modified path String */ - @ExperimentalResourceApi fun resourcePathMapping(map: (path: String) -> String) { getResourcePath = map } @@ -41,12 +39,10 @@ object WebResourcesConfiguration { * ``` */ @Suppress("unused") -@ExperimentalResourceApi fun configureWebResources(configure: WebResourcesConfiguration.() -> Unit) { WebResourcesConfiguration.configure() } -@OptIn(ExperimentalResourceApi::class) internal fun getResourceUrl(windowOrigin: String, windowPathname: String, resourcePath: String): String { val path = WebResourcesConfiguration.getResourcePath(resourcePath) return when { diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GeneratedResClassSpec.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GeneratedResClassSpec.kt index bbe8a02be4..1ecdd84f35 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GeneratedResClassSpec.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GeneratedResClassSpec.kt @@ -127,7 +127,6 @@ internal fun getResFileSpec( ) file.addType(TypeSpec.objectBuilder("Res").also { resObject -> resObject.addModifiers(resModifier) - resObject.addAnnotation(experimentalAnnotation) //readFileBytes val readResourceBytes = MemberName("org.jetbrains.compose.resources", "readResourceBytes") @@ -143,6 +142,7 @@ internal fun getResFileSpec( @return The content of the file as a byte array. """.trimIndent() ) + .addAnnotation(experimentalAnnotation) .addParameter("path", String::class) .addModifiers(KModifier.SUSPEND) .returns(ByteArray::class) @@ -164,6 +164,7 @@ internal fun getResFileSpec( @return The URI string of the file. """.trimIndent() ) + .addAnnotation(experimentalAnnotation) .addParameter("path", String::class) .returns(String::class) .addStatement("""return %M("$moduleDir" + path)""", getResourceUri) @@ -237,7 +238,6 @@ private fun getChunkFileSpec( val objectSpec = TypeSpec.objectBuilder(chunkClassName).also { typeObject -> typeObject.addModifiers(KModifier.PRIVATE) - typeObject.addAnnotation(experimentalAnnotation) val properties = idToResources.keys.map { resName -> PropertySpec.builder(resName, type.getClassName()) .delegate("\nlazy·{ init_$resName() }") @@ -250,14 +250,12 @@ private fun getChunkFileSpec( idToResources.forEach { (resName, items) -> val accessor = PropertySpec.builder(resName, type.getClassName(), resModifier) .receiver(ClassName(packageName, "Res", type.accessorName)) - .addAnnotation(experimentalAnnotation) .getter(FunSpec.getterBuilder().addStatement("return $chunkClassName.$resName").build()) .build() chunkFile.addProperty(accessor) val initializer = FunSpec.builder("init_$resName") .addModifiers(KModifier.PRIVATE) - .addAnnotation(experimentalAnnotation) .returns(type.getClassName()) .addStatement( CodeBlock.builder() diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/androidMainResourceAccessors/my/lib/res/String0.androidMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/androidMainResourceAccessors/my/lib/res/String0.androidMain.kt index c657bcaa88..4c07207da0 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/androidMainResourceAccessors/my/lib/res/String0.androidMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/androidMainResourceAccessors/my/lib/res/String0.androidMain.kt @@ -3,20 +3,16 @@ package my.lib.res import kotlin.OptIn -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.StringResource -@ExperimentalResourceApi private object AndroidMainString0 { public val android_str: StringResource by lazy { init_android_str() } } -@ExperimentalResourceApi public val Res.string.android_str: StringResource get() = AndroidMainString0.android_str -@ExperimentalResourceApi private fun init_android_str(): StringResource = org.jetbrains.compose.resources.StringResource( "string:android_str", "android_str", setOf( diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Drawable0.commonMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Drawable0.commonMain.kt index 290092ea95..408e508f37 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Drawable0.commonMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Drawable0.commonMain.kt @@ -4,9 +4,7 @@ package my.lib.res import kotlin.OptIn import org.jetbrains.compose.resources.DrawableResource -import org.jetbrains.compose.resources.ExperimentalResourceApi -@ExperimentalResourceApi private object CommonMainDrawable0 { public val _3_strange_name: DrawableResource by lazy { init__3_strange_name() } @@ -21,11 +19,9 @@ private object CommonMainDrawable0 { lazy { init_vector_2() } } -@ExperimentalResourceApi public val Res.drawable._3_strange_name: DrawableResource get() = CommonMainDrawable0._3_strange_name -@ExperimentalResourceApi private fun init__3_strange_name(): DrawableResource = org.jetbrains.compose.resources.DrawableResource( "drawable:_3_strange_name", @@ -34,11 +30,9 @@ private fun init__3_strange_name(): DrawableResource = ) ) -@ExperimentalResourceApi public val Res.drawable.camelCaseName: DrawableResource get() = CommonMainDrawable0.camelCaseName -@ExperimentalResourceApi private fun init_camelCaseName(): DrawableResource = org.jetbrains.compose.resources.DrawableResource( "drawable:camelCaseName", @@ -47,11 +41,9 @@ private fun init_camelCaseName(): DrawableResource = ) ) -@ExperimentalResourceApi public val Res.drawable.vector: DrawableResource get() = CommonMainDrawable0.vector -@ExperimentalResourceApi private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.DrawableResource( "drawable:vector", setOf( @@ -72,11 +64,9 @@ private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.Dr ) ) -@ExperimentalResourceApi public val Res.drawable.vector_2: DrawableResource get() = CommonMainDrawable0.vector_2 -@ExperimentalResourceApi private fun init_vector_2(): DrawableResource = org.jetbrains.compose.resources.DrawableResource( "drawable:vector_2", setOf( diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Font0.commonMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Font0.commonMain.kt index a7f4e06373..1d69a111bb 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Font0.commonMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Font0.commonMain.kt @@ -3,20 +3,16 @@ package my.lib.res import kotlin.OptIn -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.FontResource -@ExperimentalResourceApi private object CommonMainFont0 { public val emptyFont: FontResource by lazy { init_emptyFont() } } -@ExperimentalResourceApi public val Res.font.emptyFont: FontResource get() = CommonMainFont0.emptyFont -@ExperimentalResourceApi private fun init_emptyFont(): FontResource = org.jetbrains.compose.resources.FontResource( "font:emptyFont", setOf( diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Plurals0.commonMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Plurals0.commonMain.kt index a41fe0fadc..95ecbbca59 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Plurals0.commonMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Plurals0.commonMain.kt @@ -3,20 +3,16 @@ package my.lib.res import kotlin.OptIn -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.PluralStringResource -@ExperimentalResourceApi private object CommonMainPlurals0 { public val numberOfSongsAvailable: PluralStringResource by lazy { init_numberOfSongsAvailable() } } -@ExperimentalResourceApi public val Res.plurals.numberOfSongsAvailable: PluralStringResource get() = CommonMainPlurals0.numberOfSongsAvailable -@ExperimentalResourceApi private fun init_numberOfSongsAvailable(): PluralStringResource = org.jetbrains.compose.resources.PluralStringResource( "plurals:numberOfSongsAvailable", "numberOfSongsAvailable", diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/String0.commonMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/String0.commonMain.kt index c7848ef50d..d3a70bb1f2 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/String0.commonMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/String0.commonMain.kt @@ -3,10 +3,8 @@ package my.lib.res import kotlin.OptIn -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.StringResource -@ExperimentalResourceApi private object CommonMainString0 { public val PascalCase: StringResource by lazy { init_PascalCase() } @@ -30,11 +28,9 @@ private object CommonMainString0 { lazy { init_str_template() } } -@ExperimentalResourceApi public val Res.string.PascalCase: StringResource get() = CommonMainString0.PascalCase -@ExperimentalResourceApi private fun init_PascalCase(): StringResource = org.jetbrains.compose.resources.StringResource( "string:PascalCase", "PascalCase", setOf( @@ -43,11 +39,9 @@ private fun init_PascalCase(): StringResource = org.jetbrains.compose.resources. ) ) -@ExperimentalResourceApi public val Res.string._1_kebab_case: StringResource get() = CommonMainString0._1_kebab_case -@ExperimentalResourceApi private fun init__1_kebab_case(): StringResource = org.jetbrains.compose.resources.StringResource( "string:_1_kebab_case", "_1_kebab_case", setOf( @@ -56,11 +50,9 @@ private fun init__1_kebab_case(): StringResource = org.jetbrains.compose.resourc ) ) -@ExperimentalResourceApi public val Res.string.app_name: StringResource get() = CommonMainString0.app_name -@ExperimentalResourceApi private fun init_app_name(): StringResource = org.jetbrains.compose.resources.StringResource( "string:app_name", "app_name", setOf( @@ -69,11 +61,9 @@ private fun init_app_name(): StringResource = org.jetbrains.compose.resources.St ) ) -@ExperimentalResourceApi public val Res.string.camelCase: StringResource get() = CommonMainString0.camelCase -@ExperimentalResourceApi private fun init_camelCase(): StringResource = org.jetbrains.compose.resources.StringResource( "string:camelCase", "camelCase", setOf( @@ -82,11 +72,9 @@ private fun init_camelCase(): StringResource = org.jetbrains.compose.resources.S ) ) -@ExperimentalResourceApi public val Res.string.hello: StringResource get() = CommonMainString0.hello -@ExperimentalResourceApi private fun init_hello(): StringResource = org.jetbrains.compose.resources.StringResource( "string:hello", "hello", setOf( @@ -95,11 +83,9 @@ private fun init_hello(): StringResource = org.jetbrains.compose.resources.Strin ) ) -@ExperimentalResourceApi public val Res.string.multi_line: StringResource get() = CommonMainString0.multi_line -@ExperimentalResourceApi private fun init_multi_line(): StringResource = org.jetbrains.compose.resources.StringResource( "string:multi_line", "multi_line", setOf( @@ -108,11 +94,9 @@ private fun init_multi_line(): StringResource = org.jetbrains.compose.resources. ) ) -@ExperimentalResourceApi public val Res.string.str_template: StringResource get() = CommonMainString0.str_template -@ExperimentalResourceApi private fun init_str_template(): StringResource = org.jetbrains.compose.resources.StringResource( "string:str_template", "str_template", setOf( diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonResClass/my/lib/res/Res.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonResClass/my/lib/res/Res.kt index 4e2092bc2d..e5a1409634 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonResClass/my/lib/res/Res.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonResClass/my/lib/res/Res.kt @@ -12,7 +12,6 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.getResourceUri import org.jetbrains.compose.resources.readResourceBytes -@ExperimentalResourceApi public object Res { /** * Reads the content of the resource file at the specified path and returns it as a byte array. @@ -22,6 +21,7 @@ public object Res { * @param path The path of the file to read in the compose resource's directory. * @return The content of the file as a byte array. */ + @ExperimentalResourceApi public suspend fun readBytes(path: String): ByteArray = readResourceBytes("" + path) /** @@ -32,6 +32,7 @@ public object Res { * @param path The path of the file in the compose resource's directory. * @return The URI string of the file. */ + @ExperimentalResourceApi public fun getUri(path: String): String = getResourceUri("" + path) public object drawable @@ -43,4 +44,4 @@ public object Res { public object plurals public object font -} +} \ No newline at end of file diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/desktopMainResourceAccessors/my/lib/res/String0.desktopMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/desktopMainResourceAccessors/my/lib/res/String0.desktopMain.kt index 50c85b8d35..4fcecd75b6 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/desktopMainResourceAccessors/my/lib/res/String0.desktopMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/desktopMainResourceAccessors/my/lib/res/String0.desktopMain.kt @@ -3,20 +3,16 @@ package my.lib.res import kotlin.OptIn -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.StringResource -@ExperimentalResourceApi private object DesktopMainString0 { public val desktop_str: StringResource by lazy { init_desktop_str() } } -@ExperimentalResourceApi public val Res.string.desktop_str: StringResource get() = DesktopMainString0.desktop_str -@ExperimentalResourceApi private fun init_desktop_str(): StringResource = org.jetbrains.compose.resources.StringResource( "string:desktop_str", "desktop_str", setOf( diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/androidMainResourceAccessors/app/group/resources_test/generated/resources/String0.androidMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/androidMainResourceAccessors/app/group/resources_test/generated/resources/String0.androidMain.kt index a76ea38a4e..98e0355454 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/androidMainResourceAccessors/app/group/resources_test/generated/resources/String0.androidMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/androidMainResourceAccessors/app/group/resources_test/generated/resources/String0.androidMain.kt @@ -3,20 +3,16 @@ package app.group.resources_test.generated.resources import kotlin.OptIn -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.StringResource -@ExperimentalResourceApi private object AndroidMainString0 { public val android_str: StringResource by lazy { init_android_str() } } -@ExperimentalResourceApi internal val Res.string.android_str: StringResource get() = AndroidMainString0.android_str -@ExperimentalResourceApi private fun init_android_str(): StringResource = org.jetbrains.compose.resources.StringResource( "string:android_str", "android_str", setOf( diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Drawable0.commonMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Drawable0.commonMain.kt index 3a17148357..5e7a25ac0e 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Drawable0.commonMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Drawable0.commonMain.kt @@ -4,9 +4,7 @@ package app.group.resources_test.generated.resources import kotlin.OptIn import org.jetbrains.compose.resources.DrawableResource -import org.jetbrains.compose.resources.ExperimentalResourceApi -@ExperimentalResourceApi private object CommonMainDrawable0 { public val _3_strange_name: DrawableResource by lazy { init__3_strange_name() } @@ -21,11 +19,9 @@ private object CommonMainDrawable0 { lazy { init_vector_2() } } -@ExperimentalResourceApi internal val Res.drawable._3_strange_name: DrawableResource get() = CommonMainDrawable0._3_strange_name -@ExperimentalResourceApi private fun init__3_strange_name(): DrawableResource = org.jetbrains.compose.resources.DrawableResource( "drawable:_3_strange_name", @@ -34,11 +30,9 @@ private fun init__3_strange_name(): DrawableResource = ) ) -@ExperimentalResourceApi internal val Res.drawable.camelCaseName: DrawableResource get() = CommonMainDrawable0.camelCaseName -@ExperimentalResourceApi private fun init_camelCaseName(): DrawableResource = org.jetbrains.compose.resources.DrawableResource( "drawable:camelCaseName", @@ -47,11 +41,9 @@ private fun init_camelCaseName(): DrawableResource = ) ) -@ExperimentalResourceApi internal val Res.drawable.vector: DrawableResource get() = CommonMainDrawable0.vector -@ExperimentalResourceApi private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.DrawableResource( "drawable:vector", setOf( @@ -72,11 +64,9 @@ private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.Dr ) ) -@ExperimentalResourceApi internal val Res.drawable.vector_2: DrawableResource get() = CommonMainDrawable0.vector_2 -@ExperimentalResourceApi private fun init_vector_2(): DrawableResource = org.jetbrains.compose.resources.DrawableResource( "drawable:vector_2", setOf( diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Font0.commonMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Font0.commonMain.kt index e756e8c84c..89ff6eb7b8 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Font0.commonMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Font0.commonMain.kt @@ -3,20 +3,16 @@ package app.group.resources_test.generated.resources import kotlin.OptIn -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.FontResource -@ExperimentalResourceApi private object CommonMainFont0 { public val emptyFont: FontResource by lazy { init_emptyFont() } } -@ExperimentalResourceApi internal val Res.font.emptyFont: FontResource get() = CommonMainFont0.emptyFont -@ExperimentalResourceApi private fun init_emptyFont(): FontResource = org.jetbrains.compose.resources.FontResource( "font:emptyFont", setOf( diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Plurals0.commonMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Plurals0.commonMain.kt index f4fa373e40..9674a83744 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Plurals0.commonMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Plurals0.commonMain.kt @@ -3,20 +3,16 @@ package app.group.resources_test.generated.resources import kotlin.OptIn -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.PluralStringResource -@ExperimentalResourceApi private object CommonMainPlurals0 { public val numberOfSongsAvailable: PluralStringResource by lazy { init_numberOfSongsAvailable() } } -@ExperimentalResourceApi internal val Res.plurals.numberOfSongsAvailable: PluralStringResource get() = CommonMainPlurals0.numberOfSongsAvailable -@ExperimentalResourceApi private fun init_numberOfSongsAvailable(): PluralStringResource = org.jetbrains.compose.resources.PluralStringResource( "plurals:numberOfSongsAvailable", "numberOfSongsAvailable", diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/String0.commonMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/String0.commonMain.kt index ddfe1791a4..c57944b003 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/String0.commonMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/String0.commonMain.kt @@ -3,10 +3,8 @@ package app.group.resources_test.generated.resources import kotlin.OptIn -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.StringResource -@ExperimentalResourceApi private object CommonMainString0 { public val PascalCase: StringResource by lazy { init_PascalCase() } @@ -30,11 +28,9 @@ private object CommonMainString0 { lazy { init_str_template() } } -@ExperimentalResourceApi internal val Res.string.PascalCase: StringResource get() = CommonMainString0.PascalCase -@ExperimentalResourceApi private fun init_PascalCase(): StringResource = org.jetbrains.compose.resources.StringResource( "string:PascalCase", "PascalCase", setOf( @@ -43,11 +39,9 @@ private fun init_PascalCase(): StringResource = org.jetbrains.compose.resources. ) ) -@ExperimentalResourceApi internal val Res.string._1_kebab_case: StringResource get() = CommonMainString0._1_kebab_case -@ExperimentalResourceApi private fun init__1_kebab_case(): StringResource = org.jetbrains.compose.resources.StringResource( "string:_1_kebab_case", "_1_kebab_case", setOf( @@ -56,11 +50,9 @@ private fun init__1_kebab_case(): StringResource = org.jetbrains.compose.resourc ) ) -@ExperimentalResourceApi internal val Res.string.app_name: StringResource get() = CommonMainString0.app_name -@ExperimentalResourceApi private fun init_app_name(): StringResource = org.jetbrains.compose.resources.StringResource( "string:app_name", "app_name", setOf( @@ -69,11 +61,9 @@ private fun init_app_name(): StringResource = org.jetbrains.compose.resources.St ) ) -@ExperimentalResourceApi internal val Res.string.camelCase: StringResource get() = CommonMainString0.camelCase -@ExperimentalResourceApi private fun init_camelCase(): StringResource = org.jetbrains.compose.resources.StringResource( "string:camelCase", "camelCase", setOf( @@ -82,11 +72,9 @@ private fun init_camelCase(): StringResource = org.jetbrains.compose.resources.S ) ) -@ExperimentalResourceApi internal val Res.string.hello: StringResource get() = CommonMainString0.hello -@ExperimentalResourceApi private fun init_hello(): StringResource = org.jetbrains.compose.resources.StringResource( "string:hello", "hello", setOf( @@ -95,11 +83,9 @@ private fun init_hello(): StringResource = org.jetbrains.compose.resources.Strin ) ) -@ExperimentalResourceApi internal val Res.string.multi_line: StringResource get() = CommonMainString0.multi_line -@ExperimentalResourceApi private fun init_multi_line(): StringResource = org.jetbrains.compose.resources.StringResource( "string:multi_line", "multi_line", setOf( @@ -108,11 +94,9 @@ private fun init_multi_line(): StringResource = org.jetbrains.compose.resources. ) ) -@ExperimentalResourceApi internal val Res.string.str_template: StringResource get() = CommonMainString0.str_template -@ExperimentalResourceApi private fun init_str_template(): StringResource = org.jetbrains.compose.resources.StringResource( "string:str_template", "str_template", setOf( diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonResClass/app/group/resources_test/generated/resources/Res.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonResClass/app/group/resources_test/generated/resources/Res.kt index e3beeb0da9..9b19cafa4c 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonResClass/app/group/resources_test/generated/resources/Res.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonResClass/app/group/resources_test/generated/resources/Res.kt @@ -12,7 +12,6 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.getResourceUri import org.jetbrains.compose.resources.readResourceBytes -@ExperimentalResourceApi internal object Res { /** * Reads the content of the resource file at the specified path and returns it as a byte array. @@ -22,6 +21,7 @@ internal object Res { * @param path The path of the file to read in the compose resource's directory. * @return The content of the file as a byte array. */ + @ExperimentalResourceApi public suspend fun readBytes(path: String): ByteArray = readResourceBytes("" + path) /** @@ -32,6 +32,7 @@ internal object Res { * @param path The path of the file in the compose resource's directory. * @return The URI string of the file. */ + @ExperimentalResourceApi public fun getUri(path: String): String = getResourceUri("" + path) public object drawable diff --git a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/desktopMainResourceAccessors/app/group/resources_test/generated/resources/String0.desktopMain.kt b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/desktopMainResourceAccessors/app/group/resources_test/generated/resources/String0.desktopMain.kt index aa67ed8e2d..badfa7b5b2 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/desktopMainResourceAccessors/app/group/resources_test/generated/resources/String0.desktopMain.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/desktopMainResourceAccessors/app/group/resources_test/generated/resources/String0.desktopMain.kt @@ -3,20 +3,16 @@ package app.group.resources_test.generated.resources import kotlin.OptIn -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.StringResource -@ExperimentalResourceApi private object DesktopMainString0 { public val desktop_str: StringResource by lazy { init_desktop_str() } } -@ExperimentalResourceApi internal val Res.string.desktop_str: StringResource get() = DesktopMainString0.desktop_str -@ExperimentalResourceApi private fun init_desktop_str(): StringResource = org.jetbrains.compose.resources.StringResource( "string:desktop_str", "desktop_str", setOf( diff --git a/gradle-plugins/compose/src/test/test-projects/misc/emptyResources/expected/Res.kt b/gradle-plugins/compose/src/test/test-projects/misc/emptyResources/expected/Res.kt index 5b4a175317..b6fbefa22e 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/emptyResources/expected/Res.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/emptyResources/expected/Res.kt @@ -12,7 +12,6 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.getResourceUri import org.jetbrains.compose.resources.readResourceBytes -@ExperimentalResourceApi internal object Res { /** * Reads the content of the resource file at the specified path and returns it as a byte array. @@ -22,6 +21,7 @@ internal object Res { * @param path The path of the file to read in the compose resource's directory. * @return The content of the file as a byte array. */ + @ExperimentalResourceApi public suspend fun readBytes(path: String): ByteArray = readResourceBytes("" + path) /** @@ -32,6 +32,7 @@ internal object Res { * @param path The path of the file in the compose resource's directory. * @return The URI string of the file. */ + @ExperimentalResourceApi public fun getUri(path: String): String = getResourceUri("" + path) public object drawable diff --git a/gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/commonResClass/me/app/jvmonlyresources/generated/resources/Res.kt b/gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/commonResClass/me/app/jvmonlyresources/generated/resources/Res.kt index 4790d78126..7004b885d8 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/commonResClass/me/app/jvmonlyresources/generated/resources/Res.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/commonResClass/me/app/jvmonlyresources/generated/resources/Res.kt @@ -12,7 +12,6 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.getResourceUri import org.jetbrains.compose.resources.readResourceBytes -@ExperimentalResourceApi internal object Res { /** * Reads the content of the resource file at the specified path and returns it as a byte array. @@ -22,6 +21,7 @@ internal object Res { * @param path The path of the file to read in the compose resource's directory. * @return The content of the file as a byte array. */ + @ExperimentalResourceApi public suspend fun readBytes(path: String): ByteArray = readResourceBytes("" + path) /** @@ -32,6 +32,7 @@ internal object Res { * @param path The path of the file in the compose resource's directory. * @return The URI string of the file. */ + @ExperimentalResourceApi public fun getUri(path: String): String = getResourceUri("" + path) public object drawable diff --git a/gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/mainResourceAccessors/me/app/jvmonlyresources/generated/resources/Drawable0.main.kt b/gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/mainResourceAccessors/me/app/jvmonlyresources/generated/resources/Drawable0.main.kt index 0c5db2a8be..98f4998f2b 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/mainResourceAccessors/me/app/jvmonlyresources/generated/resources/Drawable0.main.kt +++ b/gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/mainResourceAccessors/me/app/jvmonlyresources/generated/resources/Drawable0.main.kt @@ -4,19 +4,15 @@ package me.app.jvmonlyresources.generated.resources import kotlin.OptIn import org.jetbrains.compose.resources.DrawableResource -import org.jetbrains.compose.resources.ExperimentalResourceApi -@ExperimentalResourceApi private object MainDrawable0 { public val vector: DrawableResource by lazy { init_vector() } } -@ExperimentalResourceApi internal val Res.drawable.vector: DrawableResource get() = MainDrawable0.vector -@ExperimentalResourceApi private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.DrawableResource( "drawable:vector", setOf(