Skip to content

SpringJavadocCheck incorrectly detects empty line before tag #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sbrannen opened this issue Sep 28, 2021 · 1 comment
Closed

SpringJavadocCheck incorrectly detects empty line before tag #291

sbrannen opened this issue Sep 28, 2021 · 1 comment
Milestone

Comments

@sbrannen
Copy link

While modifying the Spring Framework build to use spring-javaformat-checkstyle 0.0.28 and Checkstyle 8.41 (see commit spring-projects/spring-framework@2567b20), I noticed that the Javadoc for a few of our methods started to trigger Checkstyle violations from the SpringJavadocCheck.

Specifically, if you have an asterisk within a code or literal element, the SpringJavadocCheck thinks it has detected an empty line before a tag, even though that is not the case.

The following reproduces the issue.

/**
 * First paragraph.
 *
 * <p>Second paragraph contains an asterisk in a code element: {@code *}.
 * @since 1.0
 */
public void springJavadocCheckError() {
}

That results in:

Method Javadoc should not have empty line before tag. [SpringJavadoc]

If you change the Javadoc to this (removing the blank line)...

/**
 * First paragraph.
 * <p>Second paragraph contains an asterisk in a code element: {@code *}.
 * @since 1.0
 */
public void springJavadocCheckError() {
}

or this (moving the asterisk outside the {@code} element)...

/**
 * First paragraph.
 *
 * <p>Second paragraph contains an asterisk in a code element: *.
 * @since 1.0
 */
public void springJavadocCheckError() {
}

... then there are no Checkstyle violations.

@philwebb philwebb added this to the 0.0.x milestone Sep 28, 2021
@philwebb philwebb modified the milestones: 0.0.x, 0.0.29 Sep 28, 2021
@sbrannen
Copy link
Author

sbrannen commented Oct 1, 2021

Thanks for the quick fix, @philwebb! 👍

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

No branches or pull requests

2 participants