Skip to content

Javadoc with an unclosed inline tag is left completely unformatted #172

Open

Description

@abashev

Upstream: google/google-java-format#1509
Kind: bug | Priority: low

google-java-format#1509 (merged 2026-10-29, copybara export) only adds tests that document a limitation: in a classic Javadoc comment, an unclosed inline tag outside <pre> (such as a {@link`` without its closing brace) makes the lexer throw, and the Javadoc formatter then returns the comment unchanged. The tests cover the unclosed tag before list items, blank lines, footer tags and at the end of the comment.

Why it matters: our JavadocFormatter has the same structure (it catches LexException around line 52 and returns the input), so one typo disables Javadoc formatting for the whole comment. Upstream has not changed the behaviour yet, only pinned it down.

Affected files in our repo:

  • open-java-format/src/main/java/com/palantir/javaformat/java/javadoc/JavadocFormatter.java
  • open-java-format/src/main/java/com/palantir/javaformat/java/javadoc/JavadocLexer.java (matching-tag check)

Suggested action: watch. If upstream later formats such comments, follow; meanwhile consider a test in our suite that records the current behaviour. Examples: not available - upstream's expected output is "unchanged", so there is no before/after pair to show.


Filed from an upstream-watch ticket after manual review.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions