8000 JavadocMethod: new property 'allowInlineReturn' to support for Javadoc return tag as inline · Issue #9745 · checkstyle/checkstyle · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
JavadocMethod: new property 'allowInlineReturn' to support for Javadoc return tag as inline #9745
Closed
@Thihup

Description

@Thihup

I have downloaded the latest cli 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

How it works Now:

$ javac Foo.java
$ javadoc Foo.java 
Loading source file Foo.java...
Constructing Javadoc information...
Building index for all the packages and classes...
Standard Doclet version 16+36
Building tree for all the packages and classes...
Generating ./Foo.html...
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 ./index.html...
Generating ./help-doc.html...

config.xml

<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
        "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
   <property name="fileExtensions" value="java"/>
   <module name="TreeWalker">
       <module name="JavadocMethod">
            <property name="accessModifiers" value="public"/>
       </module>
   </module>
</module>

Foo.java

/**
 * Test
 */
public class Foo {

    /**
     * {@return the foo}
     */
    public int getFoo() { return 0; } // violation

    /**
     * Returns the bar
     * @return the bar
     */
    public int getBar() { return 0; }

}
$ RUN_LOCALE="-Duser.language=en -Duser.country=US"
$ java $RUN_LOCALE -jar ~/Downloads/checkstyle-9.0-all.jar -c config.xml Foo.java
Starting audit...
[ERROR] /tmp/Foo.java:9: @return tag should be present and have description. [JavadocMethod]
Audit done.
Checkstyle ends with 1 errors.

Is your feature request related to a problem? Please describe.
Add support for Javadoc inline return tag

Describe the solution you'd like
Both methods to be treated the same (getFoo and getBar), as it is by the Javadoc

Additional context
The support for this syntax was added in JDK 16
https://bugs.openjdk.java.net/browse/JDK-8075778

rivanov@p5510:/var/tmp$ javadoc Foo.java
Loading source file Foo.java...
Constructing Javadoc information...
Standard Doclet version 11
Building tree for all the packages and classes...
Generating ./Foo.html...
Foo.java:7: error: no tag name after @
     * {@return the foo}
       ^
Foo.java:9: warning: no @return
    public int getFoo() { return 0; } // violation
               ^


/var/tmp$ export JAVA_HOME=/opt/jvm/jdk-17.0.1/
/var/tmp$ export PATH=$JAVA_HOME/bin:$PATH
rivanov@p5510:/var/tmp$ javadoc Foo.java
Loading source file Foo.java...
Constructing Javadoc information...
Building index for all the packages and classes...
Standard Doclet version 17.0.1+12-39
Building tree for all the packages and classes...
Generating ./Foo.html...

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0