Please review a fix to make the comparator used by the JavaDoc index pages to 
be transitive (see JBS issue for a description and example of the problem).

I fix the bug by creating method `getIndexElementKey(Element)` to extract the 
key for comparing elements in `Comparator.makeIndexElementComparator`, and 
allowing `IndexBuilder` to reuse that extractor method when comparing element 
index items to search tag index items. The rationale for this approach was to 
preserve the current order for sorting elements in the index, and to keep the 
change simple (considering possible backport to 21).

In the process I also simplified some parts of the code a bit (simpler logic to 
compare names in element comparator, no need for composite comparator for 
classes-only index). 

For the test, I added various elements and search tags that trigger the 
condition to the existing `TestIndex` page and replaced `checkOutput` with 
`checkOrder` to test the order of index page items.

-------------

Commit messages:
 - Remove trailing whitespace
 - JDK-8311264: JavaDoc index comparator is not transitive

Changes: https://git.openjdk.org/jdk/pull/14776/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14776&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8311264
  Stats: 124 lines in 4 files changed: 88 ins; 9 del; 27 mod
  Patch: https://git.openjdk.org/jdk/pull/14776.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14776/head:pull/14776

PR: https://git.openjdk.org/jdk/pull/14776

Reply via email to