RFR: 8318082: ConcurrentModificationException from IndexWriter [v2]
Jonathan Gibbons
jjg at openjdk.org
Fri Oct 20 16:49:36 UTC 2023
On Fri, 20 Oct 2023 12:02:56 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> Please review this fix to a bug in indexing.
>>
>> The bug has been dormant for many releases and was noticed only because its likelihood was increased by [JDK-8286470](https://bugs.openjdk.org/browse/JDK-8286470) in JDK 21.
>>
>> Here's the bug: every time an item is indexed, it is indexed relative to the context that triggers the indexing. For example, if an item is indexed in the context of a class page, then the index will refer to that class page. However, if that same item is indexed in the context of the "Deprecated" page, then the index will refer to the "Deprecated" page.
>>
>> Since an item is indexed every time it is seen, the fix is to never index an item if seen in the context of a _derived_ page, such as hierarchy trees, indexes, and various lists (e.g. deprecated, new, preview). The fix includes a comprehensive test and updates an existing test to correct its bad assumptions.
>
> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision:
>
> Respond to feedback
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/TagletWriter.java line 375:
> 373: Content createAnchorAndSearchIndex(Element element, String tagText, Content tagContent, String desc, DocTree tree) {
> 374: Content result;
> 375: if (context.isFirstSentence && context.inSummary || context.inTags.contains(DocTree.Kind.INDEX)
If you introduce `context.isIndexable` then the code may read better if you flip the then/else parts.
if (htmlWriter.isIndexable() && context.isIndexable()) {
// index it
} else {
// don't index it
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16271#discussion_r1367249047
More information about the javadoc-dev
mailing list