RFR: JDK-8312201: Clean up common behavior in "page writers" and "member writers" [v2]

Jonathan Gibbons jjg at openjdk.org
Fri Jul 28 17:40:50 UTC 2023


On Fri, 28 Jul 2023 17:36:57 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> Please review a medium change that is a follow-up to recent work to clean up the builders and writers in the doclet.
>> 
>> This change is primarily focussed on cleaning up the code to generate summary tables for each kind of member. The bulk of the code is moved from `ClassWriter` to `AbstractMemberWriter`, with just a top-level loop remaining in `ClassWriter` to iterate over the different kinds of members. In addition, there is some cleanup in `WriterFactory`, renaming the factory methods and ensuring that those that are declared are used.
>> 
>> One result of the cleanup is that each member writer now defines and provides two methods, `buildSummary` and `buildDetails` that each create content to go on the page of the enclosing type.
>> 
>> This work uncovered two issues which are _not_ addressed here, and which may be addressed in future work.
>> 
>> 1. There is a discrepancy between the lists of `VMT.Kind` used in `AbstractMemberWriter` (for the complete lists used to generate pages and the lists of `VMT.Kind` defined in `VMT.Kind` itself, which are indirectly used to generate entries in the sub-navbar for the pages of type elements.  Those lists (defined as `Set`s, indirectly rely on the order in which the `VMT.Kind` members are declared, although the order itself is not specified.
>> 
>> 2. There is an inconsistency in the subtypes of `HtmlDocletWriter`, which all generate pages, as to how those classes are invoked. It is about 50/50 whether the classes declare a `build()` method to be called from outside, or whether the classes declare a `static void generate()` method to be used instead.
>> 
>> --
>> 
>> The initial commit contains two changes to tests, copied from PR #15046.  These changes will go away once that PR is approved, integrated and merged with this work.
>
> Jonathan Gibbons has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
> 
>  - Merge with upstream/master
>  - JDK-8312201: Cleanup common behavior in "page writers" and "member writers"

> > 8284447
> 
> You added 8284447: Remove the unused NestedClassWriter interface. Is it this PR where this ~interface~ class becomes used or #14913, which merges the class with the interface while also moving it?

It's this one; it's the changes in `ClassWriter.java` which:
* move the code to generate summaries from `ClassWriter` to `AbstractMemberWriter`
* iterate over the list of `VisibleMemberTable.Kind` to invoke `buildSummary` and `buildDetails`.

I'll add a comment to 8284447.

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

PR Comment: https://git.openjdk.org/jdk/pull/15049#issuecomment-1656089535


More information about the javadoc-dev mailing list