最佳答案
I am trying to create a parameterized class with a lateinit
non-nullable property of the generic type:
class Test<T> {
private lateinit var t : T
private lateinit var s : String
}
The latter is allowed, but the former is not. The compiler returns the following error:
Error:(7, 11) ''lateinit'' modifier is not allowed on nullable properties
Since I didn't declare T?
, I am confused as to why this is the case.