RFR: 8352740: Introduce new factory method HtmlTree.IMG

Nizar Benalla nbenalla at openjdk.org
Mon Mar 24 17:16:07 UTC 2025


Please review this small patch to add a new factory method `HtmlTree IMG(DocPath src, String alt)`, to provide a convenient way to reliably create valid tree nodes.

Previously, all uses of `HtmlTag.IMG` followed a similar pattern :

HtmlTree.of(HtmlTag.IMG)
                        .put(HtmlAttr.SRC, docpath)
                        .put(HtmlAttr.ALT, alt)


However, it was easy to forget to add the required "alt" attribute. Those have been replaced by the new factory method.

No tests are required as part of this change.

TIA

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

Commit messages:
 - add new factory method HtmlTree IMG(DocPath src, String alt)

Changes: https://git.openjdk.org/jdk/pull/24204/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24204&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8352740
  Stats: 29 lines in 4 files changed: 12 ins; 7 del; 10 mod
  Patch: https://git.openjdk.org/jdk/pull/24204.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24204/head:pull/24204

PR: https://git.openjdk.org/jdk/pull/24204


More information about the javadoc-dev mailing list