RFR: JDK-8252712: move doclint to jdk.javadoc module [v3]
Hannes Wallnöfer
hannesw at openjdk.java.net
Wed Sep 23 10:43:32 UTC 2020
On Wed, 23 Sep 2020 00:09:54 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.
>
> Jonathan Gibbons has updated the pull request incrementally with one additional commit since the last revision:
>
> Address comments
Marked as reviewed by hannesw (Reviewer).
-------------
PR: https://git.openjdk.java.net/jdk/pull/133
More information about the compiler-dev
mailing list