Make KClasses for primitives equal to KClasses for wrapper types

Both primitive int and wrapper type java.lang.Integer are represented by the
single type kotlin.Int in Kotlin, so inequality between the corresponding
KClasses was confusing here. To keep the old behavior, one may call 'k1.java ==
k2.java' instead of `k1 == k2`

 #KT-13462 Fixed
This commit is contained in:
Alexander Udalov
2016-08-09 15:42:42 +03:00
parent 3efa738bc0
commit 5b1ee13db8
7 changed files with 53 additions and 16 deletions
@@ -75,10 +75,10 @@ class ClassReference(override val jClass: Class<*>) : KClass<Any>, ClassBasedDec
private fun error(): Nothing = throw KotlinReflectionNotSupportedError()
override fun equals(other: Any?) =
other is ClassReference && jClass == other.jClass
other is ClassReference && javaObjectType == other.javaObjectType
override fun hashCode() =
jClass.hashCode()
javaObjectType.hashCode()
override fun toString() =
jClass.toString() + Reflection.REFLECTION_NOT_AVAILABLE