Confusing AnyRef equals

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Confusing AnyRef equals

Georgii Dernovyi
I found that subj returns false for the same object. It is a terrible mistake for me

case class a(i:Int)
override def canEqual(a: Any) = a.isInstanceOf[a]

override def equals(o:Any) = AnyRef.equals(o)

override def hashCode = AnyRef.hashCode

val aa = new a(1)
aa == aa //false

Am I right? )

You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit