getClass
always evaluates to false
SC-W1071The new
keyword allows you to instantiate a class where as the getClass
method defined on an object returns Class[_ <: T]
where the type T
is an upperbound. Comparing both the values will always evaluate to false. Consider using an alternative such as the .isInstanceOf
method instead.
val eq = c.getClass == new C
val eq = c.isInstanceOf[C]