Skip to content

SpringJavadocCheck incorrectly detects empty line before tag #291

Closed
@sbrannen

Description

@sbrannen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions