RFR: JDK-8252712: move doclint to jdk.javadoc module
Jonathan Gibbons
jjg at openjdk.java.net
Fri Sep 11 17:18:28 UTC 2020
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.
-------------
Commit messages:
- Merge
- move doclint to jdk.javadoc module
- add DocTrees.getCharacters(EntityTree)
Changes: https://git.openjdk.java.net/jdk/pull/133/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=133&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8252712
Stats: 605 lines in 104 files changed: 49 ins; 413 del; 143 mod
Patch: https://git.openjdk.java.net/jdk/pull/133.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/133/head:pull/133
PR: https://git.openjdk.java.net/jdk/pull/133
More information about the compiler-dev
mailing list