-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Milestone
Description
https://checkstyle.org/styleguides/google-java-style-20180523/javaguide.html
$ cat 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">
<module name="TreeWalker">
<module name="NoWhitespaceBefore"/>
</module>
</module>
$ cat Test.java
public class Test {
@C int @A [] @B [] f;
public void foo(final char @NonNull [] param) {}
void test1(String @NonNull ... param) {} // violation
void test2(String @NonNull... param) {} // OK
}
$ RUN_LOCALE="-Duser.language=en -Duser.country=US"
$ java $RUN_LOCALE -jar /var/tmp/checkstyle-8.31-SNAPSHOT-all.jar \
-c config.xml Test.java
Starting audit...
[ERROR] /var/tmp/Test.java:7:32: '...' is preceded with whitespace. [NoWhitespaceBefore]
Audit done.
Checkstyle ends with 1 errors.
4.6.2 Horizontal whitespace
........
Between a type annotation and [] or ....
Latest version of Google Style Guide mandates that there is a single space between a type annotation and []
or ...
.
There is currently no rule to check this.
Actually it is even worse, the current config (NoWhitespaceBefore
with ELLIPSIS
token) will not only not allow to verify the Google style guide, but report violations where it shouldn't as it does not allow spaces in front of ellipsis tokens.