Skip to content

The 13.4.0 is unable to parse javadocs with broken formatting #19712

@dmatej

Description

@dmatej

Upgrade from 13.3.0 to 13.4.0 broke our builds.

[INFO] There are 5 errors reported by Checkstyle 13.4.0 with org/glassfish/qa/config/checkstyle/checkstyle.xml ruleset.
[ERROR] src/main/java/org/jvnet/hk2/config/Attribute.java:[109] (imports) UnusedImports: Javadoc comment at column 13 has parse error. Details: token recognition error at: '@' while parsing  
[ERROR] src/main/java/org/jvnet/hk2/config/ConfigSupport.java:[466] (imports) UnusedImports: Javadoc comment at column 63 has parse error. Details: token recognition error at: ',' while parsing String
[ERROR] src/main/java/org/jvnet/hk2/config/ConfigSupport.java:[497] (imports) UnusedImports: Javadoc comment at column 63 has parse error. Details: token recognition error at: ',' while parsing String
[ERROR] src/main/java/org/jvnet/hk2/config/ConfigSupport.java:[549] (imports) UnusedImports: Javadoc comment at column 63 has parse error. Details: token recognition error at: ',' while parsing String
[ERROR] src/main/java/org/jvnet/hk2/config/OnDeleteCascade.java:[28] (imports) UnusedImports: Javadoc comment at column 5 has parse error. Details: mismatched input '@' expecting '<' while parsing HTML_TAG_END

Example - here the parsing is broken by the line with @see {@link DataType}:

    /**
     * Specifies the data type. It should be the fully qualified name of
     * the class that identifies the real data type. For attributes that
     * are of type defined by basic Java primitives (or wrappers), there is
     * no need to specify this field. The default value is derived from
     * method/field declaration.
     *
     * @return String specifying the name of the data type for the values of this attribute
     * @see {@link DataType}
     */
    Class dataType() default String.class;

Not sure if other checks are hit by this too, but as we noticed it between two latest releases, perhaps it could "ring the bell" to authors of changes.
Despite these javadocs are not correctly formatted, I am quite sure they should not crash the check for the unused imports.

Quick reproducer (if it would be missing some dependencies, just run mvn clean install):

git checkout git@github.com:eclipse-ee4j/glassfish.git
cd glassfish
git checkout 66b3a3061618b92318255a4f687b0c556c14f9bd
// edit nucleus/parent/pom.xml and change the checkstyle version 13.3.0 to 13.4.0
mvn clean install -pl :qa,:hk2-config-generator

The problem is any malformed javadoc

  • invalid @see combined with {@link
  • html elements including HashMap<String, Object> which just looks like html
  • typos like <code<
  • closing element without opening
  • ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions