RFR: 8321500: javadoc rejects '@' in multi-line attribute value

Hannes Wallnöfer hannesw at openjdk.org
Tue Oct 15 10:46:26 UTC 2024


Please review the removal of code in `DocCommentParser` that created an error when encountering a spurious "@" character in an HTML attribute value after a line break. 

The removed code (which was added in its current form in 2012) seemed to assume that such a "@" character was part of a block tag and therefore an indication of an unclosed attribute value. However, both line breaks and "@" are valid characters in HTML attributes. Note that valid content for HTML attributes in `DocCommentParser` is [text and entities as per HTML5][html5-attributes] as well as JavaDoc inline tags, but not block tags.

[html5-attributes]: https://html.spec.whatwg.org/multipage/syntax.html#syntax-attribute-value

The change adds two doctree tests, one to make sure HTML attributes with mixed values (text, line breaks, entities, inline tags, "@") are parsed correctly, and a second one to make sure actual unclosed attribute values are still recognized as errors.

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

Commit messages:
 - JDK-8321500: javadoc rejects '@' in multi-line attribute value

Changes: https://git.openjdk.org/jdk/pull/21520/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21520&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8321500
  Stats: 77 lines in 2 files changed: 66 ins; 9 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/21520.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21520/head:pull/21520

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


More information about the javadoc-dev mailing list