KJS: check hashCode property only for objects to avoid extra boxing for primitive values

Also in Nashorn everything has hashCode including primitive types,
so the result can be different at Nashorn and at other engines.
This commit is contained in:
Zalim Bashorov
2017-04-21 16:41:18 +03:00
parent 678d2e7c21
commit fb1c4320b6
2 changed files with 8 additions and 6 deletions
@@ -1,5 +1,7 @@
data class A(val a: Boolean)
fun box() : String {
return if( A(true).hashCode()==1 && A(false).hashCode()==0 ) "OK" else "fail"
if (A(true).hashCode() != 1) return "fail1"
if (A(false).hashCode() !=0) return "fail2"
return "OK"
}