Skip to content

Keep javadoc inline tags like {@link ...} together - #125

Merged
bulldozer-bot[bot] merged 13 commits into
developfrom
ds/javadoc
Jan 14, 2020
Merged

bulldozer-bot[bot] merged 13 commits into
developfrom
ds/javadoc

Conversation

@dansanduleac

Copy link
Copy Markdown
Contributor

Before this PR

JavadocFormatter splits inline tags with spaces, for example {@link com.palantir.SomeClass}, such that they can end up like

/**
 * Foo bar {@link
 * com.palantir.SomeClass}
 */

After this PR

==COMMIT_MSG==
In javadocs, keep inline tags like {@link ...} on one line if not already split.
==COMMIT_MSG==

Possible downsides?

@changelog-app

changelog-app Bot commented Jan 14, 2020 •

Copy link
Copy Markdown

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

In javadocs, keep inline tags like {@link ...} on the same line if not already split.

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot
policy-bot Bot requested a review from CRogers January 14, 2020 15:35
} else if (input.tryConsume("}")) {
braceDepth.decrementIfPositive();
return LITERAL;
return braceDepth.isPositive() ? LITERAL : INLINE_TAG_CLOSE;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens here with nested inline tags? I noticed there's an inlineTagDepth in the other file, but I would have thought that this would only make these tokens for the outermost (from my brief can of these changes)?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even care about nested inline tags?

@dansanduleac dansanduleac Jan 14, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we care for situations like

{@code
class Foo {
}
}<pre>

as shown in one of the tests I added, that's actually copied from one of the integration tests where this was initially being handled incorrectly.
Specifically, we want to treat the closing brace of the class as a literal (i.e. this is still literal stuff inside the code block), and only the last brace as a INLINE_TAG_CLOSE.

@dansanduleac dansanduleac Jan 14, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the other hand, in the other method, I use another one of these depth counters but I don't think the number can be anything other than 0 or 1.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

@CRogers
CRogers self-requested a review January 14, 2020 18:02
@CRogers

CRogers commented Jan 14, 2020

Copy link
Copy Markdown
Contributor

👍

@bulldozer-bot
bulldozer-bot Bot merged commit dfd2deb into develop Jan 14, 2020
@bulldozer-bot
bulldozer-bot Bot deleted the ds/javadoc branch January 14, 2020 18:21
@svc-autorelease

Copy link
Copy Markdown
Collaborator

Released 0.3.12

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants