You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PS D:\test> cat src/Test.java
import java.util.List; // expected violation here but there is no violation
/**
* @link List // invalid link
*/
class Test{
}
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<module name="TreeWalker">
<module name="UnusedImports"/>
</module>
</module>
PS D:\test> java -jar checkstyle-10.13.0-all.jar -c config.xml src/Test2.java
Starting audit...
Audit done.
Describe what you expect in detail.
This is an invalid Link because there is no { } so the check should Ignore this and It shouldn't be considered as usage So we should have a violation on import java.util.List;
the reason for that may be because we use javadocUtil and this util is based on regular expression parsing not javadoc AST
/**
* @link {Collections::emptyEnumeration} // invalid link
*/
the above link also is considered a valid link as it has a valid tagName but it shouldn't be valid. for a method reference to be a valid link it has to be like this : @link {Collections#emptyEnumeration}
The text was updated successfully, but these errors were encountered:
detected at #14548 (comment) and #14548 (comment)
I have read check documentation: https://checkstyle.sourceforge.io/checks/imports/unusedimports.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
Describe what you expect in detail.
This is an invalid Link because there is no
{ }
so the check should Ignore this and It shouldn't be considered as usage So we should have a violation onimport java.util.List;
the reason for that may be because we use javadocUtil and this util is based on regular expression parsing not javadoc AST
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtil.java
Line 121 in 8531fec
another example:
the above link also is considered a valid link as it has a valid tagName but it shouldn't be valid. for a method reference to be a valid link it has to be like this :
@link {Collections#emptyEnumeration}
The text was updated successfully, but these errors were encountered: