Skip to content

False positive: JavadocParagraph reports violation when <p> is after tags #18486

@lrozenblyum

Description

@lrozenblyum

I have read check documentation: https://checkstyle.org/checks/javadoc/javadocparagraph.html
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words


E:\temp\CheckstyleReport>type config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
  <module name="TreeWalker">
    <module name="JavadocParagraph" />
  </module>
</module>

E:\temp\CheckstyleReport>type Test.java
public interface Test {

        /**
         * Test method.
         *
         * @return some result
         *
         * <p>For example this is a nice "string", the previous line is empty so Checkstyle shouldn't complain</p>
         */
        String someMethod();
}

E:\temp\CheckstyleReport>set RUN_LOCALE="-Duser.language=en -Duser.country=US"

E:\temp\CheckstyleReport>java %RUN_LOCALE% -jar checkstyle-12.3.1-all.jar -c config.xml Test.java
Starting audit...
[ERROR] E:\temp\CheckstyleReport\Test.java:8:12: <p> tag should be preceded with an empty line. [JavadocParagraph]
Audit done.
Checkstyle ends with 1 errors.

Describe what you expect in detail.
Since there is an empty line before the tag <p> there should not be complaint about missing empty line.

It affects at least <p> tags inside the @return Javadoc block


Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions