UnusedImports: value javadoc tag does not reference imports #3157

Closed
lutovich opened this Issue May 5, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@lutovich
Contributor

lutovich commented May 5, 2016

Javadoc {@value} tag can reference static constants and makes constant value appear in the generated javadoc. Constant can be referenced either by fully qualified name {@value java.util.Calendar#MONTH} or by relative name {@value Calendar#MONTH} when corresponding import is present import java.util.Calendar;.

$ javac InputUnusedImportWithValueTag.java
$ cat InputUnusedImportWithValueTag.java
import java.util.Calendar; // import is used in javadoc {@value}

public class InputUnusedImportWithValueTag {

    /**
     * Method determines current month as for {@value Calendar#MONTH}.
     *
     * @return index of the current month.
     */
    public int currentMonth() {
        return 1;
    }
}
$ cat config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
        "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
        "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<module name="Checker">
  <module name="TreeWalker">
    <module name="UnusedImports">
      <property name="processJavadoc" value="true"/>
    </module>
  </module>
</module>
$ java -jar checkstyle-6.18-all.jar -c config.xml InputUnusedImportWithValueTag.java
Starting audit...
[ERROR] InputUnusedImportWithValueTag.java:1:8: Unused import - java.util.Calendar. [UnusedImports]
Audit done.
Checkstyle ends with 1 errors.

I'd be happy to contribute and fix this issue. Tentative fix: lutovich@25c5b4e.
Please let me know if my help is needed or PR should be created from this branch.

Thanks!

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani May 5, 2016

Member

please update description of issue to be like it is requested at http://checkstyle.sourceforge.net/report_issue.html#How_to_report_a_bug

I'd be happy to contribute and fix this issue.

contributors are always welcome.
glance through http://checkstyle.sourceforge.net/contributing.html , do PR and follow CI failures (if any).
Ask questions, I will guide you through development process.

Member

romani commented May 5, 2016

please update description of issue to be like it is requested at http://checkstyle.sourceforge.net/report_issue.html#How_to_report_a_bug

I'd be happy to contribute and fix this issue.

contributors are always welcome.
glance through http://checkstyle.sourceforge.net/contributing.html , do PR and follow CI failures (if any).
Ask questions, I will guide you through development process.

lutovich added a commit to lutovich/checkstyle that referenced this issue May 5, 2016

lutovich added a commit to lutovich/checkstyle that referenced this issue May 5, 2016

@lutovich

This comment has been minimized.

Show comment
Hide comment
@lutovich

lutovich May 5, 2016

Contributor

@romani updated description and created a PR.

Contributor

lutovich commented May 5, 2016

@romani updated description and created a PR.

lutovich added a commit to lutovich/checkstyle that referenced this issue May 5, 2016

romani added a commit that referenced this issue May 5, 2016

@romani romani added this to the 6.19 milestone May 5, 2016

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani May 5, 2016

Member

fix is merged.

Member

romani commented May 5, 2016

fix is merged.

@romani romani closed this May 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment