> Please review a simple fix that JavaDoc fails when asked to just generate > documentation for an aggegator module, or for any module that contains no > classes or interfaces to be documented, such as a service-provider module. > > The problem is the long-standing check for `no public or protected classes > found to document`. While that check does have an exception for "empty" > modules, such modules are not taken into account when specified as a > `module-info.java` file on the command line. (The workaround is to specify > the source path and use the `--module` option.) > > The fundamental part of the fix is in `ElementsTable.scanSpecifiedItems`, > where code is added to scan any compilation units read from files specified > on the command line, detect any module declarations, and add any > corresponding module names to the list of `specifiedModuleElements`. > > A secondary part of the fix is purely cosmetic. The misleadingly-named > `classTrees` and `classTreeList` are renamed to `compilationUnits` and > `compilationUnitList` to better reflect their broader use, including the > possibility of containing a module compilation unit. > > A new test is added, in two variants. > > 1. The first variant is a regular call of `JavadocTester.javadoc`. In this > call, the source path has to be set explicitly, to avoid the default setting > of the source path performed by the `javadoc` method. (The exact setting of > the source path is significant to `javac` when determining module-membership > of command-line source files.) > > 2. The second variant used `toolbox.JavadocTask` to avoid setting the source > path in any way, thus better mimicking the initial test case of `javadoc -d > path/to/api path/to/src/module-info.java` > > Both variants pass, but then trigger a downstream error of a circularity in > the redirection in the generated `index.html` file. That issue is addressed > separately, in [JDK-8322874](https://bugs.openjdk.org/browse/JDK-8322874)
Jonathan Gibbons has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: - Adjust test string - Adjust test string - Merge remote-tracking branch 'upstream/master' into 8322865.aggregator-modules - Fix comment intro - JDK-8322865: JavaDoc fails on aggregator modules ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17272/files - new: https://git.openjdk.org/jdk/pull/17272/files/8250104d..e44b02f8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17272&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17272&range=00-01 Stats: 73861 lines in 2781 files changed: 40666 ins; 15634 del; 17561 mod Patch: https://git.openjdk.org/jdk/pull/17272.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17272/head:pull/17272 PR: https://git.openjdk.org/jdk/pull/17272