Also seen on MoshiX 0.20.0. The rollback of the version to 0.19.0 helped.
Code:
@JsonClass(generateAdapter = true, generator = "sealed:type")
sealed interface PrefFavoritesSort {
val direction: PrefSortDirection
@TypeLabel("unknown")
object Unknown : PrefFavoritesSort {
override val direction: PrefSortDirection
get() = PrefSortDirection.Unknown
}
@TypeLabel("date_added")
@JsonClass(generateAdapter = true)
data class DateAdded(
override val direction: PrefSortDirection
) : PrefFavoritesSort
}
Generated code:
@Suppress("DEPRECATION", "unused", "ClassName", "REDUNDANT_PROJECTION", "RedundantExplicitType",
"LocalVariableName", "RedundantVisibilityModifier")
public class PrefFavoritesSortJsonAdapter(
moshi: Moshi,
) : JsonAdapter<PrefFavoritesSort>() {
private val runtimeAdapter: JsonAdapter<PrefFavoritesSort>
init {
val moshi_ = moshi.newBuilder()
.addAdapter<PrefFavoritesSort.Unknown>(ObjectJsonAdapter(PrefFavoritesSort.Unknown))
.build()
...
Build log:
PrefFavoritesSortJsonAdapter.kt:26:14 This declaration needs opt-in. Its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'
Moshi: 1.14.0 MoshiX: 0.21.0 Kotlin: 1.8.10 KSP: 1.8.10-1.0.9
Also seen on MoshiX
0.20.0
. The rollback of the version to0.19.0
helped.Code:
Generated code:
Build log:
PrefFavoritesSortJsonAdapter.kt:26:14 This declaration needs opt-in. Its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'