RFR: JDK-8259283: use new HtmlId and HtmlIds classes

Jonathan Gibbons jjg at openjdk.java.net
Wed Jan 6 01:18:09 UTC 2021


Please review this change to centralize the management of HTML ids used by the standard doclet in a single new factory class, `HtmlIds`, which utilizes a new type-safe wrapper class around `String` called `HtmlId`.

The new classes are used both when declaring ids (e.g. `HtmlTree.setId`) and when referencing them (e.g. `Links.createLink`).  The enum `SectionName`, which declared a set of standard ids, goes away, as do methods in `Links` and other places to create "anchors".

This is a simple refactoring: there is no intentional change of functionality, and no tests are affected or need to be updated. However, the changes do highlight the inconsistency of the use of ids: it would be good to rationalize these in separate, targeted follow-up work.

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

Commit messages:
 - fix whitespace; add doc comments
 - JDK-8259283: use new HtmlId and HtmlIds classes

Changes: https://git.openjdk.java.net/jdk/pull/1951/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1951&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8259283
  Stats: 949 lines in 35 files changed: 545 ins; 248 del; 156 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1951.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1951/head:pull/1951

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


More information about the javadoc-dev mailing list