poohbar
12/16/2019, 6:59 PMclass MyClass<T> {
var prop: T = null // error
}
why does this not work? I thought that the upper bound of a type parameter is by default Any?
Isaac Udy
12/16/2019, 7:03 PMval myThing = MyClass<String>()
val otherThing = MyClass<String?>()
What you might want to do is to use a non-nullable T (i.e. class MyClass<T: Any>()
) and a nullable prop definitionpoohbar
12/16/2019, 7:04 PM