On Wed, 5 Jul 2023 15:56:51 GMT, Hannes Wallnöfer <hann...@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.

This pull request has now been integrated.

Changeset: 0741cd32
Author:    Hannes Wallnöfer <hann...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/0741cd3289ccc89777449711ab20d6c32711f494
Stats:     124 lines in 4 files changed: 88 ins; 9 del; 27 mod

8311264: JavaDoc index comparator is not transitive

Reviewed-by: jjg

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

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

Reply via email to