RFR: JDK-8311264: JavaDoc index comparator is not transitive
Jonathan Gibbons
jjg at openjdk.org
Thu Jul 6 00:53:14 UTC 2023
On Wed, 5 Jul 2023 15:56:51 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
> 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.
Seems reasonable, and cleaner
-------------
Marked as reviewed by jjg (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14776#pullrequestreview-1515567864
More information about the javadoc-dev
mailing list