why the star projection is required in an is check in kotlin
I have this code
class Dog(private val name: Str, private val weight: T): Comparable {
override fun compareTo(other: Dog): Int {
return weight.compareTo(other.weight)
}
override fun equals(other: Any?): Boolean {
if (other == null || other !is Dog) return false
return name == other.name && weight == other.weight
}
}
* means Any? but * is accepted and Any? is not. Why is that?