Why == and equals produce different results?

Executing the following code:

inline fun <reified R> foobar() {
    println(R::class == Double::class)
    println(R::class.equals(Double::class))
}

fun main(args: Array<String>) {
    foobar<Double>()
}

      

Produces the following output:

false
true

      

Why is there a difference between == and equals in this case? IntelliJ itself suggests replacing the equal sign with ==. Also, I could have sworn that this code using == has worked in the past.

Using kotlin version 1.1.0-rc91

+3


source to share


1 answer


This behavior is a known issue when generating code for class tokens with parameters of type reified, which are tracked here: KT-17748 .



+3


source







All Articles