I simplified this by just using the IDE methods, in which subclass equals() and hashCode() refer to the superclass.