Refactor IdentifiableEntity.compareTo method
The IdentifiableEntity.compareTo method needs to be updated.
First of all I added the test of equality of the uuids.
Next step would be the problem if the name of two taxa is the same and the sec is the same (for example both taxa don't have a sec ref) the method would return 0, but this should happen only if the taxa are really equal. Normaly this should not happen but may be the last comparison should be a comparison of the created or updated date?
Updated by Andreas Müller almost 6 years ago
- Status changed from Resolved to In Progress
- Assignee changed from Andreas Müller to Katja Luther
- % Done changed from 50 to 0
The 2 fixes dfc40f67 and 44e2abe8 primarily fixed #922 and not THIS ticket.
However, during this process we realized that IdentifiableEntity.compareTo does not implement Comparable.compareTo and therefore does not necessarily need to fulfill its contract.
Also with the refactoring into both subclasses using the uuid as final decision is critical as TaxonBase.compareToTaxon uses TaxonNameBase.compareToName now and expects a 0 result if the names are equal on the cache level.
Smae applies for the mentioned requirement that compareToX should never return 0 and use e.g. date instead for sorting. Defined sorting with no equalness we should leave to Comparators and Comparable.compareTo. Here, users of the method sometimes even expect return value 0.
Therefore I suggest that we should close this ticket as won't fix or maybe better we still include a better handling for protected titleCaches in case of TaxonBase but leave the rest as it is.
Updated by Katja Luther almost 6 years ago
- Status changed from In Progress to Rejected
- Assignee changed from Katja Luther to Andreas Müller
Close the ticket as we moved the methods to TaxonNameBase and TaxonBase and the compareToX methods do not implement the Comparable.compareTo method.