-
Notifications
You must be signed in to change notification settings - Fork 5.8k
JDK-8254627: Cleanup {Abstract,Single,Split}IndexWriter classes #621
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
JDK-8254627: Cleanup {Abstract,Single,Split}IndexWriter classes #621
Conversation
👋 Welcome back jjg! A progress list of the required criteria for merging this PR into |
@jonathan-gibbons The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Note that the apparently-new file |
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.
Nice work!
headerContent.add(navBar.getContent(Navigation.Position.TOP)); | ||
Content mainContent = new ContentBuilder(); | ||
List<Character> allFirstCharacters = new ArrayList<>(mainIndex.getFirstCharacters()); | ||
allFirstCharacters.sort(Comparator.naturalOrder()); |
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.
It seems a bit redundant to retrieve and sort the allFirstCharacters
list in each invocation of generateIndexFile
, maybe pass it as an argument from the generate(HtmlConfiguration)
method?
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.
Given your other comment (listed next in this page) that the sort is actually unnecessary, it may be not so important to pass in the list of all first characters from the generate
method, but it is easy enough to do so. I will check it out.
public static void generate(HtmlConfiguration configuration) throws DocFileIOException { | ||
IndexBuilder mainIndex = configuration.mainIndex; | ||
List<Character> firstCharacters = mainIndex.getFirstCharacters(); | ||
firstCharacters.sort(Comparator.naturalOrder()); |
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.
Is this sorting step necessary? Aren't the characters returned by IndexBuilder#getFirstCharacters()
already guaranteed to be in natural order?
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.
Interesting ... while the contract is not enforced through the type system, the words of the spec do guarantee the ordering.
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.
A related minor improvement that I will try out is to return an immutable set from main Index.getFirstCharacters
@jonathan-gibbons 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 16 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
@jonathan-gibbons Since your change was applied there have been 16 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 3fb2e82. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Inspired by other recent work to cleanup index generation, this change is primarily about cleanup for
AbstractIndexWriter
,SingleIndexWriter
,SplitIndexWriter
to reduce code duplication and to reduce the 3 class to just 1 that can handle either single index files or split index files.As part of this cleanup, some anomalies were uncovered in the naming of annotation types, enum constants and records, which have also been addressed.
The changes involved moving/merging code from
SingleIndexWriter
andSplitIndexWriter
in toAbstractIndexWriter
, which is now no longer abstract and is thus renamed to justIndexWriter
. Regrettably, the rename is not properly tracked.Progress
Testing
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/621/head:pull/621
$ git checkout pull/621