I have the following class:
@Parcelize
data class Collection<T : Parcelable> constructor(
var models: List<T>,
var cursor: String?
) : Parcelable
When I was using Kotlin 1.4.10
, the project builds correctly without any errors, then I updated the project to Kotlin 1.4.21
, and migrated to use kotlin-parcelize
instead of kotlin-android-extensions
, so after Kotlin update, when building the project I get the following errors:
> Task :domain:kaptDebugKotlin FAILED
/Library/DevelopmentArea/workspace/baaz_android_new/clean_domain/domain/build/tmp/kapt3/stubs/debug/com/myapp/domain/model/Collection.java:101: error: non-static type variable T cannot be referenced from a static context
public final com.myapp.domain.model.Collection<T>[] newArray(int size) {
^/Library/DevelopmentArea/workspace/baaz_android_new/clean_domain/domain/build/tmp/kapt3/stubs/debug/com/myapp/domain/model/Collection.java:110: error: non-static type variable T cannot be referenced from a static context
public final com.myapp.domain.model.Collection<T> createFromParcel(@org.jetbrains.annotations.NotNull()
Note: I'm using Android Studio 4.1.1