Experimental APIs, subject to change in future versions of Kotlin.
Questions tagged [kotlin-experimental]
12 questions
17
votes
4 answers
Handling multiple experimental annotations throughout an app
I have an app that makes heavy use of experimental features for Jetpack Compose so I have to declare a bunch of annotations on the composables. Since these annotations require callers to also declare them I have ended up in a situation where I have…

Alix
- 2,630
- 30
- 72
15
votes
3 answers
Room database with Kotlin inline class as an Entity field
I am trying to get Room(https://developer.android.com/topic/libraries/architecture/room) work with Kotlin's inline classes as described in Jake Whartons article Inline Classes Make Great Database IDs:
@Entity
data class MyEntity(
@PrimaryKey val…

whlk
- 15,487
- 13
- 66
- 96
11
votes
1 answer
Can't find referenced class kotlin.internal.annotations.AvoidUninitializedObjectCopyingCheck
When ProGuard is enabled for an Android project with Kotlin, the Gradle build fails with the following error:
Warning: HomeChargerLocation: can't find
referenced class
kotlin.internal.annotations.AvoidUninitializedObjectCopyingCheck
Warning:…

makovkastar
- 5,000
- 2
- 30
- 50
8
votes
2 answers
How to use Kotlin ExperimentalUnsignedTypes project wide (AndroidStudio)
I'm trying to use the @ExperimentalUnsignedTypes in my AndroidStudio project. It seems I have to put that just about everywhere, so I'd rather set it once project wide.
The documentation says
Usages of such API will be reported as warnings unless…

Travis Griggs
- 21,522
- 19
- 91
- 167
7
votes
2 answers
'@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'
e: /Users/abc/update/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (29, 33): This declaration is experimental and its usage must be marked with '@kotlin.ExperimentalStdlibApi' or…

Sanjeev Kumar
- 71
- 1
- 2
6
votes
1 answer
react-native-gradle-plugin kotlin.ExperimentalStdlibApi declaration is experimental and its usage must be marked
I have been trying to build React Native App i have been searching everywhere I cannot solve this issue. Any help or advise would be very much apprenticed.
My Android build has this…

Anthony
- 801
- 10
- 20
4
votes
1 answer
Can I use a Kotlin Contract to guarantee the non-nullity of another property?
I have a class with a nullable property description: String?, and for convenience would like to expose a fun hasDescription(): Boolean that null-checks said String.
For even more convenience, I am hoping to use a contract so I can smart cast…

Dan Ahlquist
- 161
- 1
- 6
2
votes
1 answer
Kotlin inline class in JUnit tests
I am trying to understand concept of inline classes - they are a simple object wrapper of single property that is being inlined during runtime.
That means, that the actual initialization of the class is not happening at runtime
I was trying to write…

K.Os
- 5,123
- 8
- 40
- 95
1
vote
3 answers
Kotlin 1.3.50 Parcelize unresolved reference error
Working my first android app, kotlin 1.3.50. I initially implemented Parcelable, but switched to parcelize and then added the enums. Here is my data class
package com.igniterobotics.scouting_2019.Models
import android.os.Parcel
import…

BCarlson
- 1,122
- 2
- 11
- 26
1
vote
4 answers
kotlin async doesn't compile
The following code doesn't compile, although the documentation says it should be as simple as this:
override fun onResume() {
super.onResume()
async {
Log.d("foo", "async")
}
}
The error is:
...kt: (31, 9): None of the following…

user2297550
- 3,142
- 3
- 28
- 39
0
votes
1 answer
Kotlin: How to use higher order functions with OpenEndRange
I want to use higher order functions like map for open end ranges.
val from = LocalDate.now().minusDays(10)
val to = LocalDate.now()
(from ..< to).forEach(::println)
I tried to copy an example for ClosedRange but it does not…

Ben Keil
- 1,050
- 1
- 10
- 30
-2
votes
1 answer
UByteArray equality operator
In Kotlin code I have two UByteArray objects, and I want to know if they have the same stuff in them:
val a : UByteArray = get()
val b : UByteArray = get()
if (a == b) println("The same stuff")
Is the equality operator sufficient, or do I have to…

QED
- 9,803
- 7
- 50
- 87