-
Notifications
You must be signed in to change notification settings - Fork 6.2k
JDK-8311264: JavaDoc index comparator is not transitive #14776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back hannesw! A progress list of the required criteria for merging this PR into |
jonathan-gibbons
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable, and cleaner
|
@hns This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 9 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
|
/integrate |
|
Going to push as commit 0741cd3.
Your commit was automatically rebased without conflicts. |
|
/backport jdk21 |
|
@hns the backport was successfully created on the branch hns-backport-0741cd32 in my personal fork of openjdk/jdk21. To create a pull request with this backport targeting openjdk/jdk21:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21: |
|
I can see that I'm late to the party. FWIW, the change looks good to me. There's probably one additional problem that predates this PR. I see that Comparators.makeIndexElementComparator breaks ties by comparing fully qualified names. Although unlikely to happen in practise, in theory it might break when one has a static nested class and a class in the default package (hence not applicable to JDK) that share FQN. Here's an example I used for one of our tests earlier (you might need to scroll it if reading inline on GitHub): jdk/test/langtools/jdk/javadoc/doclet/testThrowsInheritanceMatching/TestExceptionTypeMatching.java Lines 350 to 396 in 0616648
|
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 inComparator.makeIndexElementComparator, and allowingIndexBuilderto 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
TestIndexpage and replacedcheckOutputwithcheckOrderto test the order of index page items.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14776/head:pull/14776$ git checkout pull/14776Update a local copy of the PR:
$ git checkout pull/14776$ git pull https://git.openjdk.org/jdk.git pull/14776/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14776View PR using the GUI difftool:
$ git pr show -t 14776Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14776.diff
Webrev
Link to Webrev Comment