Integrated: JDK-8252712: move doclint to jdk.javadoc module

Jonathan Gibbons jjg at openjdk.java.net
Wed Sep 23 19:58:29 UTC 2020


On Fri, 11 Sep 2020 17:11:51 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

> doclint is a component that can check documentation comments, that can be invoked from either javac or javadoc, via the
> `-Xdoclint` family of options.
> When JDK was modularized in JDK9, doclint was left in the `jdk.compiler` module because of direct references to the
> code from javac, even though functionally the code more naturally belongs in the `jdk.javadoc` module.
> This change moves the code into the `jdk.javadoc`, using a service/provider API to make the functionality available to
> javac. This should be completely transparent, as long as the `jdk.javadoc` module is available when performing service
> binding. If it is not available, a default no-op implementation is automatically used instead.  One minor complication:
> the old code used static methods on the `DocLint` class to validate options. This is no longer possible when using the
> service provider mechanism. Instead, the methods are changed to instance methods. The javac `Option` enum has no way to
> cleanly cache an instance of the service provider class, and so a new instance is created for each option. However,
> this is a relatively lightweight operation, and can reasonably be done for the typically few doclint-related options on
> the command line.  Note: JShell has been making minor use of an internal  doclint class enum `HtmlTag`, which is no
> longer easily available. A minimal local enum is left behind in JShell's `JavadocFomatter` class, sufficient to its
> requirements. Since the dominant use of the enum is in `switch` statements, an alternative solution, avoiding the local
> enum, would be to use strings and _switch on string_ instead.  However, the use of the local enum is a smaller
> disturbance to the `JavadocFormatter` class.

This pull request has now been integrated.

Changeset: f765a7f5
Author:    Jonathan Gibbons <jjg at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/f765a7f5
Stats:     580 lines in 104 files changed: 47 ins; 384 del; 149 mod

8252712: move doclint to jdk.javadoc module

Reviewed-by: hannesw

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

PR: https://git.openjdk.java.net/jdk/pull/133


More information about the compiler-dev mailing list