RFR: 8300517: Refactor VisibleMemberTable (method members)

Jonathan Gibbons jjg at openjdk.org
Tue Mar 7 23:29:17 UTC 2023


On Mon, 6 Mar 2023 19:48:48 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

> Please review this explorative refactoring for VisibleMemberTable (VMT).
> 
> This is the first round of refactoring for VMT. This round is about *method members*: declared (overriding and not) and inherited.
> 
> During this work I gained some insight into internal workings of VMT, fixed what was feasible and left TODOs and FIXMEs for everything else. Leaving those comments might look untidy, but leaving them out is wasteful: they clearly mark issues that should be revisited in upcoming rounds of refactoring.
> 
> As I see it today, the main issue with VMT is that implements complex and error-prone computations from Java Language Specification (JLS) by hand. For example, VMT interprets JLS rules for relations such as _inherits_, _overrides_ and _hides_. As one would imagine, sometimes VMT does it incorrectly. It would be better to eventually re-implement VMT using `javax.lang.model` as much as possible. Unlike that of `jdk.javadoc`, the day job of `javax.lang.model` is to provide JLS services.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java line 294:

> 292:         var enclosing = (TypeElement) method.getEnclosingElement();
> 293:         var overrideInfo = utils.overriddenMethod(method);
> 294:         var vmt = configuration.getVisibleMemberTable(enclosing);

minor style suggestion, since you like clear informative name ...
Calling it just `vmt` makes it seem like a singleton;  how about calling it `enclosingVmt`? (I agree the camelCase is horrible)

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java line 308:

> 306:             //   for these methods:
> 307:             //     * ForkJoinPool.execute(java.lang.Runnable)
> 308:             //  This is a long-standing bug, which must be fixed separately.

Recommend include a JBS issue to track this.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java line 307:

> 305:                                             Content dl) {
> 306:         Utils utils = writer.utils;
> 307:         if (writer.options.noComment()) {

I presume that `static` methods are filtered beforehand

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

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


More information about the javadoc-dev mailing list