Skip to content

false positive invalid tag JavadocType  #16087

@Machine-Maker

Description

@Machine-Maker

https://checkstyle.org/checks/javadoc/javadoctype.html#JavadocType

/var/tmp $ javac Test.java
# success

/var/tmp $ cat checkstyle.xml
<!DOCTYPE module PUBLIC
    "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
    "https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
  <module name="TreeWalker">
    <module name="JavadocType"/>
  </module>
</module>

/var/tmp $ cat Test.java
/**
 * <pre>{@code
 * @Internal
 * class Other {
 *   @Nullable String test(String param) {
 *   }
 * }
 * }</pre>
 */
public class Test {
  public void test(String param) {
  }
}

/var/tmp $ java -jar checkstyle-10.21.0-all.jar -c checkstyle.xml test.java
Starting audit...
[ERROR] /Users/jake/Projects/Java/checkstyle-test/Test.java:3:4: Unknown tag 'Internal'. [JavadocType]
[ERROR] /Users/jake/Projects/Java/checkstyle-test/Test.java:5:6: Unknown tag 'Nullable'. [JavadocType]
Audit done.
Checkstyle ends with 2 errors.

@Internal and @Nullable should not be reported as an unknown tag. It is inside a valid pre/code tag combo which is displayed correctly by the javadoc tool. You can see the rendered html below.
CleanShot 2024-12-29 at 07 39 32@2x

Metadata

Metadata

Assignees

No one assigned

    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