We'd like to make some optimizations that are gated behind the equals method on subclasses of InternalAggregation working perfectly. But at the moment it's quite easy implement equals incorrectly - our default equals implementation checks a few things but doesn't force subclasses to override it with their extra data. Many do, but not all. We should make not overriding equals here a compile time failure. Generally we do this by adding an abstract boolean doEquals method and calling it in equals. That's a bit tricky here because of all the layers of subclasses, but we can do it.
Description
We'd like to make some optimizations that are gated behind the
equals
method on subclasses ofInternalAggregation
working perfectly. But at the moment it's quite easy implementequals
incorrectly - our default equals implementation checks a few things but doesn't force subclasses to override it with their extra data. Many do, but not all. We should make not overridingequals
here a compile time failure. Generally we do this by adding anabstract boolean doEquals
method and calling it inequals
. That's a bit tricky here because of all the layers of subclasses, but we can do it.