GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — False positive: JavadocParagraph reports violation when `<p>` is after tags · Issue #18486 · checkstyle/checkstyle

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

New issue
Copy link
New issue
Copy link
Closed
Closed
False positive: JavadocParagraph reports violation when <p> is after tags#18486
Copy link
Labels
approvedbugfalse positiveissues where check places violations on code, but should notgoogle style
Milestone
13.2.0

Description

@lrozenblyum
lrozenblyum
opened on Jan 2, 2026
Issue body actions

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


Activity

  1. lrozenblyum commented on Jan 5, 2026

    @lrozenblyum
    lrozenblyum
    on Jan 5, 2026
    Author
    More actions

    NOTE: the problem is reproduced also in other contexts, not just after the @return tag (e.g. after the @implNote tag

  2. lrozenblyum
    changed the title [-]False positive: JavadocParagraph reports violation when `<p>` is after the @return tag[/-] [+]False positive: JavadocParagraph reports violation when `<p>` is after tags[/+] on Jan 5, 2026
  3. romani commented on Jan 25, 2026

    @romani
    romani
    on Jan 25, 2026
    Member
    More actions
    $ javadoc Test.java
    Loading source file Test.java...
    Constructing Javadoc information...
    Building index for all the packages and classes...
    Standard Doclet version 21.0.9+7-LTS-338
    Building tree for all the packages and classes...
    Generating ./Test.html...
    Test.java:1: warning: no comment
    public interface Test {
           ^
    Generating ./package-summary.html...
    Generating ./package-tree.html...
    Generating ./overview-tree.html...
    Building index for all classes...
    Generating ./allclasses-index.html...
    Generating ./allpackages-index.html...
    Generating ./index-all.html...
    Generating ./search.html...
    Generating ./index.html...
    Generating ./help-doc.html...
    1 warning
    
    ~/tmp$ cat 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();
    }
    
    Image
  4. romani
    added
    approved
    google style
    false positiveissues where check places violations on code, but should not
    on Jan 25, 2026
  5. romani commented on Jan 25, 2026

    @romani
    romani
    on Jan 25, 2026
    Member
    More actions

    we should investigate what Google style opinion on such case, we should use auto formatter to see what it is doing on such cases.

  6. navin-oss commented on Jan 26, 2026

    @navin-oss
    navin-oss
    on Jan 26, 2026
    More actions

    I am on it.

  7. romani commented on Jan 27, 2026

    @romani
    romani
    on Jan 27, 2026
    Member
    More actions

    @navin-oss, please share output of Google formatter on such snippet of java

  8. navin-oss commented on Jan 27, 2026

    @navin-oss
    navin-oss
    on Jan 27, 2026
    More actions

    Hi @romani,

    I ran Google Java Format on the same snippet.

    Command used:

    google-java-format Test.java

    Formatted output:

    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();
    }

    Google Java Formatter keeps the empty line before the <p> tag and does not move or collapse it.

  9. romani commented on Jan 28, 2026

    @romani
    romani
    on Jan 28, 2026
    Member
    More actions

    Ok this is 100% checkstyle defect

  10. navin-oss commented on Jan 28, 2026

    @navin-oss
    navin-oss
    on Jan 28, 2026
    More actions

    Thanks for the confirmation 👍

    I’ve verified that this is indeed a Checkstyle defect by comparing against Google Java Format output.

    I won’t be able to continue with the fix right now, but I wanted to share the formatter results so the issue is well-documented for whoever picks it up next.

    Thanks for the quick feedback!.....

  11. Aman-Baliyan commented on Jan 28, 2026

    @Aman-Baliyan
    Aman-Baliyan
    on Jan 28, 2026
    Member
    More actions

    Input File ->

    package temp;
    
    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();
    }
    

    command used ->

    java -jar google-java-format-1.33.0-all-deps.jar Test.java

    output ->

    package temp;
    
    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
       */
      String someMethod();
    }
    

    Two key Rules for this ->

    7.1.2 Paragraphs
    One blank line—that is, a line containing only the aligned leading asterisk (*)—appears between paragraphs, and before the group of block tags if present. Each paragraph except the first has <p> immediately before the first word, with no space after it. HTML tags for other block-level elements, such as <ul> or <table>, are not preceded with <p>.

    7.1.3 Block tags
    Any of the standard "block tags" that are used appear in the order @param, @return, @throws, @deprecated, and these four types never appear with an empty description. When a block tag doesn't fit on a single line, continuation lines are indented four (or more) spaces from the position of the @.

    In think according to these rules there should be no description present after Block tags and if present then it should be considered as a part of descirption of block tag that's why the p block in the input is merged in the return tag description with 4 indentation.
    the description should always present before Block tags.

  12. romani commented on Jan 29, 2026

    @romani
    romani
    on Jan 29, 2026
    Member
    More actions

    P html-tag inside javadoc-block-tag could be skipped from validation if there any problem to validate them in javadoc-block-tags.

    I pretty sure that 7.1.2 Paragraphs is for general content of javadoc to ease reading from sources. We can looks at guava or any other google code if they ever do P tag in jvadoc-block-tags and what they do for formating.

  13. Aman-Baliyan commented on Jan 29, 2026

    @Aman-Baliyan
    Aman-Baliyan
    on Jan 29, 2026
    Member
    More actions

    i checked guava code but i did not find any example in which p tag is used inside block tag although it can be used inside block tags so i try examples by myself and format them by java-google-format the results are -

    example -

    input -

    package temp;
    
    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>
         *
         * <p>This is some comment</p>
         */
        String someMethod();
    }
    

    command used ->

    java -jar google-java-format-1.33.0-all-deps.jar Test.java

    output ->

    package temp;
    
    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>This is some comment
       */
      String someMethod();
    }
    
  14. Aman-Baliyan commented on Jan 29, 2026

    @Aman-Baliyan
    Aman-Baliyan
    on Jan 29, 2026
    Member
    More actions

    so we have to extend the check so that it checks for p blocks inside the block tags and give violations according to google format like in this example there is no space between p blocks inside block tags when formatted

  15. navin-oss commented on Jan 29, 2026

    @navin-oss
    navin-oss
    on Jan 29, 2026
    More actions

    @Aman-Baliyan thanks for the detailed investigation with Google Java Format.

    Just to clarify the findings:

    When Google Java Format processes @return followed by <p> tags, it behaves in one of two ways:

    • It keeps the empty line before <p> (as seen in the earlier test), or
    • It merges the <p> content into the @return description, indenting it by 4 spaces (as seen in the later test).

    In both cases, Checkstyle’s current behavior of requiring an empty line before <p> is incorrect because:

    • The empty line already exists (a line containing only *), or
    • The <p> tag is semantically part of the block tag content, where different formatting rules apply.

    So I agree with @romani that we should either:

    • Skip paragraph validation for <p> tags inside Javadoc block tags, or
    • Adjust the empty-line detection logic to properly handle javadoc-block-tag contexts.

    This would align Checkstyle’s behavior more closely with Google Java Format and the Google Javadoc style.

  16. romani commented on Jan 30, 2026

    @romani
    romani
    on Jan 30, 2026
    Member
    More actions

    yes, lets align,
    Should be no violation around "P" tag that is under javadoc block tags.

    Reacted by Aman Baliyan
  17. Aman-Baliyan commented on Jan 31, 2026

    @Aman-Baliyan
    Aman-Baliyan
    on Jan 31, 2026
    Member
    More actions

    i am on it

  18. Shubhamyadav93
    added a commit that references this issue on Feb 1, 2026

    Issue checkstyle#18486: Fix false positive in JavadocParagraph for tags

    ff77a80
  19. romani
    added a commit that references this issue on Feb 3, 2026

    Issue #18486: Refractor JavadocParagraph Check

    4857b2d
  20. romani commented on Feb 3, 2026

    @romani
    romani
    on Feb 3, 2026
    Member
    More actions

    Fix is merged

  21. romani
    closed this as completedon Feb 3, 2026
  22. romani
    added
    bug
    on Feb 3, 2026
  23. github-actions
    added this to the 13.2.0 milestone on Feb 3, 2026
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

    approvedbugfalse positiveissues where check places violations on code, but should notgoogle style

    Type

    No type

    Projects

    No projects

      Milestone

      • 13.2.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.