OO-1083: check if the 2 objects are of the same class before compare them with the generic compareTo method