I’m injecting a class that is annotated with `@Exp...
# getting-started
v
I’m injecting a class that is annotated with
@ExperimentalStdlibApi
The compiler asks me to handle this and the Kotlin plugin offers me 5 options to do that. I’m confused which one to choose?
m
its exactly how you want to handle it. The use of an experimental library can be a big problem, as the class or function CAN simply disappear in later versions. Do you simply not care at all? I believe you can even opt-in on a compiler level throughout your whole application with
-Xopt-in=kotlin.ExperimentalStdlibApi
.
v
Maybe tell us which of the options you don't understand
v
I ended up with adding
@ExperimentalStdlibApi
on the second class. I more or less understand all options, thanks their description is self-explanatory. Wasn’t sure which one is correct to use, without going deep in details of each
v
Correct depends on your use-case. Do you want to opt-in only for the constructor, or for the whole class or for all code in the file or do you want to delay this opt-in to the user of that constructor or class.
v
Looks like the best way to handle is to opt out from an experimental stdlib feature 🙂