I have read check documentation: https://checkstyle.org/checks/imports/avoidstarimport.html#AvoidStarImport
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:
/var/tmp $ cat config.xml
<module name="Checker">
<property name="localeLanguage" value="en"/>
<module name="TreeWalker">
<module name="AvoidStarImport"/>
</module>
</module>
/var/tmp $ cat YOUR_FILE.java
package temp;
import java.util.*;
public class Test {
}
/var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
/var/tmp $ java -jar checkstyle-13.2.0-all.jar -c config.xml Test.java
Starting audit...
[ERROR] C:\Users\amanc\Downloads\Ai_Interviewer\PracticeCheckStyle\src\temp\Test.java:3:17: Using the '.*' form of import should be avoided - java.util.*. [AvoidStarImport]
Audit done.
Checkstyle ends with 1 errors.
Is your feature request related to a problem? Please describe.
According to openjdk guidelines - https://cr.openjdk.org/~alundblad/styleguide/index-v6.html#toc-import-statements one star import is allowed but AvoidStarImport did not support this rule.
Describe the solution you'd like
We can create a new property in AvoidStarImport module which allow single star import.
Starting audit...
Audit done.
I have read check documentation: https://checkstyle.org/checks/imports/avoidstarimport.html#AvoidStarImport
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:
Is your feature request related to a problem? Please describe.
According to openjdk guidelines - https://cr.openjdk.org/~alundblad/styleguide/index-v6.html#toc-import-statements one star import is allowed but AvoidStarImport did not support this rule.
Describe the solution you'd like
We can create a new property in AvoidStarImport module which allow single star import.